[Name]
[Synopsis]
[Description]
[Files]
[Bugs]
[Author]
[History]
text_areas.py - provide text area classes which parse and
print themselves
import text_areas
description = '''\
<<title Document title>>
<<section Spam>>
<<subsection Eggs>>
Some text.
<<subsection Even more eggs>>
More text. ;-)
'''
doc = text_areas.Document(
'', # we don't have a name for the document yet
description,
1 ) # we want a contents list at the top
print doc # emit the HTML code
text_areas.py provides several classes and helper routines
to turn ``HTML file descriptions'' into HTML code. Here is only an
overwiew of the classes. For more information, refer to the source
code.
- Text_area. This is an abstract base class, i. e. you shouldn't
use it.
- Title(name,text), the title of the document. The argument
text is not used.
- Text(name,text), simple text, the name is not used.
- Section(name,text), may contain text and subsections
- Subsection(name,text), contains only text
- Contents(name,text), contents line. The argument name
is not used. A Contents object is usually automatically created
by Document.
- Document(name,text), the whole document description. The argument
name is not used.
The helper routines are
- make_html, converts some special formats (with case
insensitive ``keywords''), which don't depend on the Text_area classes:
| from | to |
| <<LINK url;url_text>> |
<A HREF="url">url_text</A> |
| <<LINK url>> |
<A HREF="url">url</A> |
| <<B text>> |
<B>text</B>, similar for I, EM etc. |
| <<PROG program name>> |
<EM>program name</EM> |
| <<FILE filename>> |
<EM>filename</EM> |
- make_label(name), replaces all not alphanumeric characters in a string
with underscores _ and returns the resulting string
- make_anchor(name), generates an anchor from a given name (e. g. a
section title) and returns the resulting string
html_format.py contains the formatting information for
the HTML code.
makepage.py contains an example
of how to overwrite the formatting without changing html_format.py.
Soon to come. ;-)
Stefan Schwarzer <s.schwarzer@ndh.net>
- 20000807 0.8. Change of version number (see README).
- 20000102 0.1.1. <<sectiontext>> at the beginning of a
section is no longer neccessary.
- 19991226 0.1 beta, initial version.
Top of this page