Package epydoc :: Package markup :: Module javadoc :: Class ParsedJavadocDocstring
[hide private]
[frames] | no frames]

Class ParsedJavadocDocstring
source code


An encoded version of a Javadoc docstring. Since Javadoc is a fairly simple markup language, we don't do any processing in advance; instead, we wait to split fields or resolve crossreference links until we need to.

Instance Methods [hide private]
  __init__(self, docstring, errors=None)
Create a new ParsedJavadocDocstring.
  _check_links(self, errors)
Make sure that all @{link}s are valid.
string to_plaintext(self, docstring_linker, **options)
Translate this docstring to plaintext.
ParsedDocstring summary(self)

Inherited from ParsedDocstring: __add__, concatenate, index_terms, to_latex

    Field Splitting
(ParsedDocstring, list of Field) split_fields(self, errors=None)
Split this docstring into its body and its fields.
    HTML Output
string to_html(self, docstring_linker, **options)
Translate this docstring to HTML.

Class Variables [hide private]
    Field Splitting
_ARG_FIELDS A list of the fields that take arguments.
_FIELD_RE A regular expression used to search for Javadoc block tags.
    HTML Output
_LINK_SPLIT_RE A regular expression used to search for Javadoc inline tags.
_LINK_RE A regular expression used to process Javadoc inline tags.

Method Details [hide private]

__init__(self, docstring, errors=None)
(Constructor)

source code 
Create a new ParsedJavadocDocstring.
Parameters:
  • docstring (string) - The docstring that should be used to construct this ParsedJavadocDocstring.
  • errors (list of ParseError) - A list where any errors generated during parsing will be stored. If no list is given, then all errors are ignored.

split_fields(self, errors=None)

source code 
Split this docstring into its body and its fields.
Returns: (ParsedDocstring, list of Field)
A tuple (body, fields), where body is the main body of this docstring, and fields is a list of its fields.
Overrides: ParsedDocstring.split_fields
(inherited documentation)

to_html(self, docstring_linker, **options)

source code 
Translate this docstring to HTML.
Returns: string
An HTML fragment that encodes this docstring.
Overrides: ParsedDocstring.to_html
(inherited documentation)

_check_links(self, errors)

source code 
Make sure that all @{link}s are valid. We need a separate method for ths because we want to do this at parse time, not html output time. Any errors found are appended to errors.

to_plaintext(self, docstring_linker, **options)

source code 
Translate this docstring to plaintext.
Returns: string
A plaintext fragment that encodes this docstring.
Overrides: ParsedDocstring.to_plaintext
(inherited documentation)

summary(self)

source code 
Returns: ParsedDocstring
A short summary of this docstring. Typically, the summary consists of the first sentence of the docstring.
Overrides: ParsedDocstring.summary
(inherited documentation)

Class Variable Details [hide private]

_ARG_FIELDS

A list of the fields that take arguments. Since Javadoc doesn't mark arguments in any special way, we must consult this list to decide whether the first word of a field is an argument or not.
Value:
['group',
 'variable',
 'var',
 'type',
 'cvariable',
 'cvar',
 'ivariable',
 'ivar',
...                                                                    
      

_FIELD_RE

A regular expression used to search for Javadoc block tags.
Value:
(^\s*@\w+[\s\$])                                                       
      

_LINK_SPLIT_RE

A regular expression used to search for Javadoc inline tags.
Value:
(\{@link(?:plain)?\s[^\}]+\})                                          
      

_LINK_RE

A regular expression used to process Javadoc inline tags.
Value:
\{@link(?:plain)?\s+([\w#\.]+)(?:\([^\)]*\))?(\s+.*)?\}