HTML bettering?

Lars Marius Garshol larsga at ifi.uio.no
Wed Jun 16 10:59:53 EDT 1999


* Matej Cepl
|
| How to make as simple as tool which would make some simple operation
| over HTML (e.g., headings numbering)? If I would use htmllib.py, I
| would have to build HTMLformatter or I am wrong and it is easy?

You could very well use htmllib and just make an htmllib application
that writes the HTML back out again, and modify it slightly to do
heading numbering. I don't think HTMLFormatter would do you any good
for this sort of thing.

However, HTML isn't a very good SGML application for this sort of
thing, since the following is entirely legal:

<!DOCTYPE ...>
<HTML>
  ...

<BODY>
<H5>On the topic of nesting</H5>

<H2>Why it's good</H2>

<H4>And why HTML doesn't have it</H4>

...
</HTML>


ISO HTML provides a better starting point for this sort of thing, as
do most other SGML applications intended for articles.

Personally, I use a private SGML DTD for my articles and then use
DSSSL stylesheets to produce the HTML, complete with a table of
contents. Adding heading numbering should take all of 5 minutes. :)

And today I've put together the infrastructure to produce PDF from the
same SGML source as well.

Here's an example:

<URL: http://www.stud.ifi.uio.no/~larsga/download/artikler/perl.html>

--Lars M.




More information about the Python-list mailing list