Base class for HappyDoc formatters.
Methods
|
|
|
|
__init__
|
__init__ (
self,
docSet,
pythonLibDoc='http://www.python.org/doc/current/lib',
**extraNamedParameters,
)
Initialize the output formatter.
Parameters:
-
docSet
- documentation set controlling this formatter
-
pythonLibDoc
- Base of URL for Python library
documentation. Defaults to
http://www.python.org/doc/current/lib .
-
extraNamedParameters
- Parameters specified by name
which were not interpreted by a subclass initialization.
|
|
_popListContext
|
_popListContext ( self )
Remove context from the list context stack.
|
|
_pushListContext
|
_pushListContext ( self, resetCurrentContext )
Add to the list context for nested lists.
|
|
_requiredOfSubclass
|
_requiredOfSubclass ( self, name )
Convenient way to raise a consistent exception.
Exceptions
|
|
AttributeError( '%s is not implemented for this class.' % name, self.__class__.__name__ )
|
|
|
_unquoteString
|
_unquoteString ( self, str )
Remove surrounding quotes from a string.
|
|
closeOutput
|
closeOutput ( self, output )
Close the output handle.
|
|
comment
|
comment (
self,
text,
output,
)
Output text as a comment, if the output format supports comments.
|
|
descriptiveListFooter
|
descriptiveListFooter ( self, output )
|
|
descriptiveListHeader
|
descriptiveListHeader (
self,
output,
title,
)
|
|
descriptiveListItem
|
descriptiveListItem (
self,
output,
item,
description,
)
|
|
dividingLine
|
dividingLine (
self,
output,
fill='-',
span=80,
)
Output a sectional dividing line.
Parameters:
- output
- destination for written output
- fill="-"
- character to use to draw the line
- span=80
- horizontal width of line to draw
|
|
fileFooter
|
fileFooter ( self, output )
Write the file footer to the output stream.
|
|
fileHeader
|
fileHeader (
self,
title1,
title2=None,
output=None,
)
Write the title and subtitle header to an open file.
|
|
fixUpOutputFilename
|
fixUpOutputFilename ( self, filename )
Tweak the filename to meet formatter-specific requirements.
The default behavior is to return the same value.
|
|
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.
|
|
getFullOutputNameForObject
|
getFullOutputNameForObject ( self, infoObject )
Get the full name, including path, to the object being output.
|
|
getInternalReference
|
getInternalReference ( self, infoSource )
Return a reference to infoSource within an open documentation node.
Return a string containing a reference which points to the
documentation for an object from the current node.
|
|
getNameForInfoSource
|
getNameForInfoSource ( self, infoSource )
Return the name for an infoSource.
|
|
getNamedReference
|
getNamedReference (
self,
infoSource,
name,
relativeSource,
)
Return a reference from relativeSource to name within infoSource.
Return a string containing a reference which points to the
documentation for name from the node located at
relativeSource . The relativeSource parameter is a string
naming a node from which the reference should work.
|
|
getOutputNameForFile
|
getOutputNameForFile ( self, filename )
Return the base name of the thing to which output should be
written for a file. This is usually a file name, but could be
anything understood by the formatter as a name. If infoObject
is None, return the name for a root node for this formatter.
|
|
getOutputNameForObject
|
getOutputNameForObject ( self, infoObject )
Return the base name of the thing to which output should be written
for an info source. This is usually a file name, but could
be anything understood by the formatter as a name. If
infoObject is None, return the name for a root node for this
formatter.
|
|
getPythonReference
|
getPythonReference ( self, moduleName )
Return a reference pointing to Python.org.
Return a reference to the standard documentation for a
standard Python library module on http://www.python.org.
|
|
getReference
|
getReference (
self,
infoSource,
relativeSource,
name=None,
)
Return a reference from relativeSource to infoSource.
Return a string containing a reference which points to the
documentation for an object from the node located at
relativeSource. The relativeSource parameter is a string
naming a node from which the reference should work.
Parameters
- infoSource
- Documentation, target of reference.
- relativeSource
- Start point of reference
- name=None
- Name to use in the reference, if supported and
supplied.
|
|
itemFooter
|
itemFooter ( self, output )
|
|
itemHeader
|
itemHeader (
self,
output,
title,
)
|
|
listFooter
|
listFooter ( self, output )
|
|
listHeader
|
listHeader (
self,
output,
title,
allowMultiColumn=1,
)
|
|
listItem
|
listItem (
self,
output,
text,
)
|
|
openOutput
|
openOutput (
self,
name,
title1,
title2=None,
)
Open the named output destination and give a title and subtitle.
|
|
popSectionLevel
|
popSectionLevel ( self, output )
|
|
pushSectionLevel
|
pushSectionLevel ( self, output )
|
|
sectionFooter
|
sectionFooter ( self, output )
|
|
sectionHeader
|
sectionHeader (
self,
output,
title,
)
|
|
supportedOptions
|
supportedOptions ( self )
Returns a dictionary of option names and descriptions.
|
|
writeCode
|
writeCode (
self,
text,
textFormat,
output,
)
Write the text to the output formatted as source code.
|
|
writeRaw
|
writeRaw (
self,
text,
output,
)
Write the unaltered text to the output destination.
|
|
writeText
|
writeText (
self,
text,
output,
textFormat,
quote=1,
)
Write the text to the output destination.
Arguments
-
text
- text to output
-
output
- output file object
-
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.
|