Package epydoc :: Package markup :: Module doctest :: Class XMLDoctestColorizer

[hide private]
[frames] | no frames]

# Class XMLDoctestColorizer

source code

A subclass of DoctestColorizer that generates XML-like output. This class is mainly intended to be used for testing purposes.

Instance Methods | [hide private]

markup(self, s, tag) Apply syntax highlighting to a single substring from a doctest block. | source code

Inherited from `DoctestColorizer`: `colorize_codeblock`, `colorize_doctest`, `colorize_inline`, `subfunc`

Class Variables | [hide private]

| PREFIX = ``'``<colorized>\n``'`` A string that is added to the beginning of the strings returned by colorize_codeblock and colorize_doctest.
| SUFFIX = ``'``</colorized>\n``'`` A string that is added to the end of the strings returned by colorize_codeblock and colorize_doctest.
Inherited from `DoctestColorizer`: `DOCTEST_DIRECTIVE_RE`, `DOCTEST_EXAMPLE_RE`, `DOCTEST_RE`, `EXCEPT_RE`, `PROMPT2_RE`, `PROMPT_RE` Inherited from `DoctestColorizer` (private): `_BI`, `_BUILTINS`, `_BUILTIN_GRP`, `_COMMENT_GRP`, `_DEFINE_GRP`, `_KEYWORDS`, `_KEYWORD_GRP`, `_KW`, `_PROMPT1_GRP`, `_PROMPT2_GRP`, `_STRING_GRP`

Method Details | [hide private]

### markup(self, s, tag)

source code

Apply syntax highlighting to a single substring from a doctest block. `s` is the substring, and `tag` is the tag that should be applied to the substring. `tag` will be one of the following strings:

- `prompt` -- the Python PS1 prompt (>>>)
- `more` -- the Python PS2 prompt (...)
- `keyword` -- a Python keyword (for, if, etc.)
- `builtin` -- a Python builtin name (abs, dir, etc.)
- `string` -- a string literal
- `comment` -- a comment
- `except` -- an exception traceback (up to the next >>>)
- `output` -- the output from a doctest block.
- `defname` -- the name of a function or class defined by a `def` or `class` statement.
- `other` -- anything else (does *not* include output.)

Overrides: DoctestColorizer.markup
  (inherited documentation)