HtmlUtils

HTML utility functions.

cpip.util.HtmlUtils.pathSplit(p)

Split a path into its components.

cpip.util.HtmlUtils.retHtmlFileName(thePath)

Creates a unique, short, human readable file name base on the input file path.

cpip.util.HtmlUtils.writeDictTreeAsTable(theS, theDt, tableAttrs, includeKeyTail)

Writes a DictTreeHtmlTable object as a table, for example as a directory structure. The key list in the DictTreeHtmlTable object is the path to the file i.e. os.path.abspath(p).split(os.sep) and the value is expected to be a pair of (link, nav_text) or None.

cpip.util.HtmlUtils.writeFileListAsTable(theS, theFileLinkS, tableAttrs, includeKeyTail)

Writes a list of file names as an HTML table looking like a directory structure. theFileLinkS is a list of pairs (file_path, href). The navigation text in the cell will be the basename of the file_path.

cpip.util.HtmlUtils.writeFileListTrippleAsTable(theS, theFileLinkS, tableAttrs, includeKeyTail)

Writes a list of file names as an HTML table looking like a directory structure. theFileLinkS is a list of triples (file_name, href, nav_text).

cpip.util.HtmlUtils.writeFilePathsAsTable(valueType, theS, theKvS, tableStyle, fnTd)

Writes file paths as a table, for example as a directory structure.

valueType
The type of the value; None, |'list' | 'set'
theKvS
A list of pairs (file_path, value).
tableStyle
The style used for the table.
fnTd

A callback function that is executed for a <td> element when there is a non-None value. This is called with the following arguments:

theS
The HTML stream.
attrs
A map of attrs that include the rowspan/colspan for the <td>
k
The key as a list of path components.
v
The value given by the caller.

Writes a link to another HTML file that represents source code. theS is an XHTML stream. theSrcPath is the path of the original source, whis will be encoded with retHtmlFileName(). theLineNum is an integer line number in the target. theText is optional navigation text. theClass is optional CSS class for the navigational text.

Previous topic

FileStatus

Next topic

ListGen

This Page