Home | Trees | Index | Help |
|
---|
Package epydoc :: Package markup :: Module epytext |
|
doctest
module.
para
blocks:
<!ENTITY % colorized '(code | math | index | italic | bold | uri | link | symbol)*'> <!ELEMENT epytext ((para | literalblock | doctestblock | section | ulist | olist)*, fieldlist?)> <!ELEMENT para (#PCDATA | %colorized;)*> <!ELEMENT section (para | listblock | doctestblock | section | ulist | olist)+> <!ELEMENT fieldlist (field+)> <!ELEMENT field (tag, arg?, (para | listblock | doctestblock) ulist | olist)+)> <!ELEMENT tag (#PCDATA)> <!ELEMENT arg (#PCDATA)> <!ELEMENT literalblock (#PCDATA)> <!ELEMENT doctestblock (#PCDATA)> <!ELEMENT ulist (li+)> <!ELEMENT olist (li+)> <!ELEMENT li (para | literalblock | doctestblock | ulist | olist)+> <!ATTLIST li bullet NMTOKEN #IMPLIED> <!ATTLIST olist start NMTOKEN #IMPLIED> <!ELEMENT uri (name, target)> <!ELEMENT link (name, target)> <!ELEMENT name (#PCDATA | %colorized;)*> <!ELEMENT target (#PCDATA)> <!ELEMENT code (#PCDATA | %colorized;)*> <!ELEMENT math (#PCDATA | %colorized;)*> <!ELEMENT italic (#PCDATA | %colorized;)*> <!ELEMENT bold (#PCDATA | %colorized;)*> <!ELEMENT indexed (#PCDATA | %colorized;)> <!ELEMENT symbol (#PCDATA)>
Classes | |
---|---|
ParsedEpytextDocstring |
|
Token |
Token s are an intermediate data structure used while
constructing the structuring DOM tree for a formatted docstring. |
Exceptions | |
---|---|
ColorizingError |
An error generated while colorizing a paragraph. |
StructuringError |
An error generated while structuring a formatted documentation string. |
TokenizationError |
An error generated while tokenizing a formatted documentation string. |
Function Summary | |
---|---|
xml.dom.minidom.Document
|
Return a DOM tree encoding the contents of an epytext string. |
xml.dom.minidom.Document
|
Return a DOM document matching the epytext DTD, containing a single literal block. |
xml.dom.minidom.Document
|
Return a DOM document matching the epytext DTD, containing a single paragraph. |
ParsedDocstring
|
Parse the given docstring, which is formatted using epytext; and return a ParsedDocstring representation of its contents. |
xml.dom.minidom.Document
|
Pretty-parse the string. |
string
|
Convert a DOM document encoding epytext back to an epytext string, annotated with extra debugging information. |
string
|
Convert a DOM document encoding epytext back to an epytext string. |
string
|
Convert a DOM document encoding epytext to a string representation. |
Add a new list item or field to the DOM tree, with the given bullet or field tag. | |
Colorize the given paragraph, and add it to the DOM tree. | |
Add a new section to the DOM tree, with the given heading. | |
Element
|
Given a string containing the contents of a paragraph, produce a DOM Element encoding that paragraph. |
_colorize_link(doc,
link,
token,
end,
errors)
| |
Pop any completed blocks off the stack. | |
list of Token
|
Split a given formatted docstring into an ordered list of Token s, according to the epytext markup rules. |
int
|
Construct a Token containing the doctest block starting
at lines[start] , and append it to tokens . |
int
|
Construct Token s for the bullet and the first
paragraph of the list item (or field) starting at
lines[start] , and append them to tokens . |
int
|
Construct a Token containing the literal block starting
at lines[start] , and append it to tokens . |
int
|
Construct a Token containing the paragraph starting at
lines[start] , and append it to tokens . |
Variable Summary | |
---|---|
list |
SYMBOLS : A list of the of escape symbols that are supported by epydoc. |
SRE_Pattern |
_BRACE_RE = [\{\}]
|
SRE_Pattern |
_BULLET_RE = -( +|$)|(\d+\.)+( +|$)|@\w+( [^\{\}:\n]+)?:...
|
dict |
_COLORIZING_TAGS = {'S': 'symbol', 'C': 'code', 'B': 'bo...
|
dict |
_ESCAPES = {'lb': '{', 'rb': '}'}
|
SRE_Pattern |
_FIELD_BULLET_RE = @\w+( [^\{\}:\n]+)?:( +|$)
|
str |
_HEADING_CHARS = '=-~'
|
list |
_LINK_COLORIZING_TAGS = ['link', 'uri']
|
SRE_Pattern |
_LIST_BULLET_RE = -( +|$)|(\d+\.)+( +|$)
|
dict |
_SYMBOLS = {'xi': 1, '>=': 1, 'lArr': 1, 'Chi': 1, 'omeg...
|
SRE_Pattern |
_TARGET_RE = ^(.*?)\s*<(?:URI:|L:)?([^<>]+)>$
|
Function Details |
---|
parse(str, errors=None)Return a DOM tree encoding the contents of an epytext string. Any errors generated during parsing will be stored inerrors .
|
parse_as_literal(str)Return a DOM document matching the epytext DTD, containing a single literal block. That literal block will include the contents of the given string. This method is typically used as a fall-back when the parser fails.
|
parse_as_para(str)Return a DOM document matching the epytext DTD, containing a single paragraph. That paragraph will include the contents of the given string. This can be used to wrap some forms of automatically generated information (such as type names) in paragraphs.
|
parse_docstring(docstring, errors, **options)Parse the given docstring, which is formatted using epytext; and return aParsedDocstring representation of its
contents.
|
pparse(str, show_warnings=1, show_errors=1, stream=<cStringIO.StringO object at 0x8504f68>)Pretty-parse the string. This parses the string, and catches any warnings or errors produced. Any warnings and errors are displayed, and the resulting DOM parse structure is returned.
|
to_debug(tree, indent=4, seclevel=0)Convert a DOM document encoding epytext back to an epytext string, annotated with extra debugging information. This function is similar toto_epytext , but it adds explicit
information about where different blocks begin, along the left
margin.
|
to_epytext(tree, indent=0, seclevel=0)Convert a DOM document encoding epytext back to an epytext string. This is the inverse operation fromparse . I.e., assuming there are no
errors, the following is true:
|
to_plaintext(tree, indent=0, seclevel=0)Convert a DOM document encoding epytext to a string representation. This representation is similar to the string generated byto_epytext , but to_plaintext removes inline
markup, prints escaped characters in unescaped form, etc.
|
_add_list(doc, bullet_token, stack, indent_stack, errors)Add a new list item or field to the DOM tree, with the given bullet or field tag. When necessary, create the associated list. |
_add_para(doc, para_token, stack, indent_stack, errors)Colorize the given paragraph, and add it to the DOM tree. |
_add_section(doc, heading_token, stack, indent_stack, errors)Add a new section to the DOM tree, with the given heading. |
_colorize(doc, token, errors, tagName='para')Given a string containing the contents of a paragraph, produce a DOMElement encoding that paragraph. Colorized regions are
represented using DOM Element s, and text is represented
using DOM Text s.
|
_pop_completed_blocks(token, stack, indent_stack)Pop any completed blocks off the stack. This includes any blocks that we have dedented past, as well as any list item blocks that we've dedented to. The top element on the stack should only be a list if we're about to start a new list item (i.e., if the next token is a bullet). |
_tokenize(str, errors)Split a given formatted docstring into an ordered list ofToken s, according to the epytext markup rules.
|
_tokenize_doctest(lines, start, block_indent, tokens, errors)Construct aToken containing the doctest block
starting at lines[start] , and append it to
tokens . block_indent should be the
indentation of the doctest block. Any errors generated while tokenizing
the doctest block will be appended to errors .
|
_tokenize_listart(lines, start, bullet_indent, tokens, errors)ConstructToken s for the bullet and the first
paragraph of the list item (or field) starting at
lines[start] , and append them to tokens .
bullet_indent should be the indentation of the list item.
Any errors generated while tokenizing will be appended to
errors .
|
_tokenize_literal(lines, start, block_indent, tokens, errors)Construct aToken containing the literal block
starting at lines[start] , and append it to
tokens . block_indent should be the
indentation of the literal block. Any errors generated while tokenizing
the literal block will be appended to errors .
|
_tokenize_para(lines, start, para_indent, tokens, errors)Construct aToken containing the paragraph starting
at lines[start] , and append it to tokens .
para_indent should be the indentation of the paragraph .
Any errors generated while tokenizing the paragraph will be appended to
errors .
|
Variable Details |
---|
_BRACE_RE
|
_BULLET_RE
|
_COLORIZING_TAGS
|
_ESCAPES
|
_FIELD_BULLET_RE
|
_HEADING_CHARS
|
_LINK_COLORIZING_TAGS
|
_LIST_BULLET_RE
|
_SYMBOLS
|
_TARGET_RE
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Sat Mar 20 17:46:14 2004 | http://epydoc.sf.net |