HTMLgen docs, tutorial

U

user

Checking out HTMLgen, I find the manual
to be quite terse, and difficult to crack.

Are there any examples or tutorials available
for this package?

Thanks,

Tobiah
 
M

Mathias Waack

Checking out HTMLgen, I find the manual
to be quite terse, and difficult to crack.

Are there any examples or tutorials available
for this package?

Its quite easy: if you have a HTML-tag with included text,
just use the approriate class and pass the text as argument:

<p>hallo</p> becomes Para("hallo")

Headers take an additional argument, the level:

<h1>Head</h1> becomes H(1,"Head")

Nested tags are the same es nested function calls. Each tag
is a container and has an append()-method:

p = Para("hallo")
p.append("another hallo")

Each tag-class ctor takes keyword arguments which become
tag arguments:

l = OrderedList(type='i')

creates an <ol type='i'> like list.

For further info look at the sources, esp. at the HTMLtest
module.

Mathias
 
U

user

Its quite easy:

Thanks,

That helps quite a bit.

Then there are the document classes. Does one normally
just append element classes to a document and then ask
the document to print itself?

Thanks,

Tobiah
 
G

Gerrit Muller

Thanks,

That helps quite a bit.

Then there are the document classes. Does one normally
just append element classes to a document and then ask
the document to print itself?

Thanks,

Tobiah
I have stripped one of my scripts to a more or less minimal example below:

doc = SimpleDocument(title"pageTitle")
doc.meta = Meta(name="keywords",content="Keywords")
row = TR()
row.append(TD("text")),valign="TOP",bgcolor="#FFFFFF"),"\n")
doc.append(TableLite(row))
doc.write("name.html"))

kind regards Gerrit
 
J

John Dean

Checking out HTMLgen, I find the manual
to be quite terse, and difficult to crack.

Are there any examples or tutorials available
for this package?

Thanks,

Tobiah

Unfortunately, that's all there is with the exception of a very small
section in the O'Reilly book, "Python Programming".
What I would like to know is, is HTMLgen still actively maintained. The
reason I ask is because I have added quite a bit of new stuff and I would
like to have my addition included in the main distro. I have tried emailing
the author but I have not receive a reply.
If anybody would be interested I could make my mods available of download
from my web site at http://www.rygannon.com or http://www.totalrekall.co.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top