Formatter which produces HTML with tables.
The output from this formatter is not generally suitable for
printing, but works fine for online documentation. The primary
concern with printing the output is that the nested tables can
cause pages to be very wide, especially with a lot of nesting of
classes. Printable HTML output should be addressed by another
formatter. Parameters
- compactHTML
- A boolean switch to cause the formatter
to generate more compact HTML. Extra
whitespace is removed in order to make the
generated files take up less space and
download more quickly. The default is
False to cause output to be more readable.
- filenamePrefix
- A prefix to preprend to the base names of
files and directories being created. This
is useful for situations where the names
which would be automatically generated might
cause a name clash or conflict.
- pageBackgroundColor
- Background color for HTML pages
- levelOneHeadingBackgroundColor
- Background color for level
one heading sections.
- levelOneHeadingForegroundColor
- Foreground color for level
one heading sections.
- levelTwoHeadingBackgroundColor
- Background color for level
two heading sections
- levelTwoHeadingForegroundColor
- Foreground color for level
two heading sections.
- codeForegroundColor
- Foreground color for code blocks.
- dateStampFiles
- Boolean indicating whether or not to include
a date/time stamp in files.
- htmlQuoteText
- Boolean indicating whether or not to assume
that docstrings need to be quoted because
they might have special HTML characters in
them. Defaults to true so that text is
quoted.
- debug
- Enable debugging comments in output.
Base Classes
|
|
happydoclib.formatter.fileformatterbase.FileBasedFormatter
|
Methods
|
|
|
|
__init__
|
__init__ (
self,
docSet,
pageBackgroundColor='#ffffff',
levelOneHeadingBackgroundColor='#88bbee',
levelOneHeadingForegroundColor='#000000',
levelTwoHeadingBackgroundColor='#99ccff',
levelTwoHeadingForegroundColor='#000000',
codeForegroundColor='#000088',
docsetTitle=None,
dateStampFiles=1,
htmlQuoteText=1,
compactHTML=0,
debug=0,
**configuration,
)
Initialize the HTMLTableFormatter.
Parameters
-
docSet
- the DocSet instance containing global cross-reference
information
-
**configuration
- additional, optional, configuration values
|
|
_fixReference
|
_fixReference (
self,
reference,
sep=os.sep,
)
All HTML links use the '/ separator, so here the current
platform separator needs to be replaced with the /'.
|
|
_writeListItems
|
_writeListItems (
self,
items,
output,
)
Format and output the items as list elements.
|
|
closeOutput
|
closeOutput ( self, output )
Close the output handle.
|
|
comment
|
comment (
self,
text,
output,
)
Output text as a comment.
|
|
dedent
|
dedent ( self, output )
End an indented section.
|
|
descriptiveListFooter
|
descriptiveListFooter ( self, output )
Write the closing footer for a descriptive list to the output .
|
|
descriptiveListHeader
|
descriptiveListHeader (
self,
output,
title,
)
Write the title as the heading for a descriptive list to the output .
|
|
descriptiveListItem
|
descriptiveListItem (
self,
output,
item,
description,
descriptionFormat,
)
Format and write the item and description for a descriptive list to the output .
|
|
dividingLine
|
dividingLine (
self,
output,
fill='-',
)
Write a sectional dividing line made up of repeated fill characters to the output .
|
|
fileFooter
|
fileFooter ( self, output )
Write the formatting for a file footer to the open file.
|
|
fileHeader
|
fileHeader (
self,
title1,
title2=' ',
output=None,
)
Write the formatting for a file header to the open file.
|
|
formatCode
|
formatCode (
self,
text,
textFormat,
)
Format text as source code and return the new string.
|
|
formatKeyword
|
formatKeyword ( self, text )
Format text as a keyword and return the new string.
|
|
genericSectionFooter
|
genericSectionFooter ( self, output )
Write a general purpose section closing footer to the output .
|
|
genericSectionHeader
|
genericSectionHeader (
self,
output,
title1,
title2,
anchor=None,
)
Output a standard nested table chunk which represents a section header.
The output looks something like this:
|--------|---------------------------|
| title1 | title2 |
| |---------------------------|
| | section text goes here
|--------|
Parameters
-
output
- destination for written output
-
title1
- title to be placed in left column
-
title2
- title to be placed on top of right column
-
anchor
- optional, anchor to which a reference can point
to find this section
|
|
getFilenameExtension
|
getFilenameExtension ( self )
Returns the extension for creating output files.
|
|
getInternalReference
|
getInternalReference ( self, infoSource )
Returns a reference to infoSource within the current document.
|
|
getNamedReference
|
getNamedReference (
self,
infoSource,
name,
relativeSource,
)
Returns a reference to name within the documentation for
infoSource from relativeSource .
|
|
getPythonReference
|
getPythonReference ( self, moduleName )
Returns a reference to moduleName documentation on the
Python.org documentation site.
|
|
getReference
|
getReference (
self,
infoSource,
relativeSource,
name=None,
)
Returns a reference to the infoSource from relativeSource .
|
|
getRootLocation
|
getRootLocation ( self, output )
Return the root documentation node location relative to this output location.
|
|
getRootNodeName
|
getRootNodeName ( self )
Returns the name of the root node for documentation of this type.
|
|
htmlFooter
|
htmlFooter ( self, output )
Output a standard HTML footer used by all output files.
|
|
htmlHeader
|
htmlHeader (
self,
title,
subtitle,
titleBg,
titleFg,
output,
)
Output a standard HTML header used by all output files.
Parameters
-
title
- title of the document
-
output
- destination for written output
-
titleBg
- background color for the title bar
-
titleFg
- foreground color for text in the title bar
|
|
indent
|
indent ( self, output )
Begin an indented section.
|
|
itemFooter
|
itemFooter ( self, output )
Write a section closing footer to the output .
|
|
itemHeader
|
itemHeader (
self,
output,
infoObject,
)
Write a section openning header for an infoObject to the output .
|
|
listFooter
|
listFooter ( self, output )
Write the closing footer for a list to the output .
|
|
listHeader
|
listHeader (
self,
output,
title=None,
allowMultiColumn=1,
)
Output title as a heading for a list. If allowMultiColumn is
true, set up the list to have more than one column.
|
|
listItem
|
listItem (
self,
output,
text,
)
Format and output the text as a list element.
|
|
openOutput
|
openOutput (
self,
name,
title1,
title2=' ',
)
Open output destination using name with the title from title1 .
Write title2 as a secondary title to the new output.
|
|
popSectionLevel
|
popSectionLevel ( self, output )
Pop a section level from the output stack.
|
|
pushSectionLevel
|
pushSectionLevel ( self, output )
Push a section level on the output stack.
|
|
sectionFooter
|
sectionFooter ( self, output )
Write a general purpose section closing footer to the output .
|
|
sectionHeader
|
sectionHeader (
self,
output,
title,
)
Write a general purpose section openning title to the output .
|
|
writeCode
|
writeCode (
self,
text,
textFormat,
output,
)
Format and write the text to output as source code.
|
|
writeHTML
|
writeHTML (
self,
text,
output,
)
Remove extra white space in HTML before outputting.
|
|
writeText
|
writeText (
self,
text,
output,
textFormat,
quote=1,
)
Format and write the text to the output .
Arguments:
-
text
- String to be written.
-
output
- Stream to which
text should be written.
-
textFormat
- String identifying the format of
text so
the formatter can use a docstring converter to convert the
body of text to the appropriate output format.
-
quote=1
- Boolean option to control whether the text
should be quoted to escape special characters.
|
|