[NTG-context] How to process simple HTML files with LuaTeX

Mojca Miklavec mojca.miklavec.lists at gmail.com
Thu Sep 13 15:04:34 CEST 2007


Hello,

I was trying to figure out how to process simple HTML files with the
new code, but I fail to understand the details. Here's a simple file I
would like to process:

<html>
<head>
	<title>My first HTML2ConTeXt</title>
</head>
<body>
	<h1>Main Title</h1>
	<p>Some text ...</p>
	<h2>Subtitle</h2>
	<p>Some text again ...</p>
	<h1>Second title</h1>
	<p>... and not much more text here either ...</p>
</body>
</html>

And the failed tries here:

% engine=luatex
\setupcolors[state=start]
\setuphead[subject][style=bfa,color=blue]
\setuphead[subsubject][style=tfa,color=blue]

\starttext
\xmlload{main}{test.html}{}
\xmlgrab{main}{h1}{h1}
\xmlgrab{main}{h2}{h2}

\startxmlsetups h1
\subject{H1: #1}
\stopxmlsetups

\startxmlsetups h2
\subsubject{H2: #1}
\stopxmlsetups

How to grab only the title out of here?

\xmlfilter{main}{html/head/title}

\xmlflush{main}
\stoptext

Any hints most wellcome.

Thank a lot,
     Mojca


More information about the ntg-context mailing list