Creating Output in XHTML Format
Generating output from pDynamo programs in XHTML format, instead of plain text, is straightforward. An example,
Example10XHTML.py, is given in the examples directory of the pDynamo distribution. The
essential differences between this example and its equivalent plain text version,
- Define an instance of the
XHTMLLogFileWriter class before any output occurs. A suitable command is:
logFile = XHTMLLogFileWriter ( title = "Some text." ). The title
keyword argument defines the title to be used in the header section of the XHTML page.
- Optionally write out a header at the top of the page using
logFile.Header ( "Some text." ).
- Include the keyword argument
log = logFile in all subsequent calls of functions and methods that produce output. E.g.
molecule.Energy ( log =
- Terminate output to the page with the statement
logFile.Footer ( ). This method call is essential, in contrast to the use of Header which is optional.