web2py.gluon.highlight.Highlighter

Package web2py :: Package gluon :: Module highlight :: Class Highlighter |
[hide private]
[frames] | no frames]

# Class Highlighter

source code

    object --+
             |
            Highlighter

Do syntax highlighting.

Instance Methods | [hide private]
__init__(self, mode, link=global_settings.applications_parent, styles=global_settings.applications_parent) Initialise highlighter:... | source code
c_tokenizer(self, token, match, style) Callback for C specific highlighting. | source code
python_tokenizer(self, token, match, style) Callback for python specific highlighting. | source code
html_tokenizer(self, token, match, style) Callback for HTML specific highlighting. | source code
highlight(self, data) Syntax highlight some python code. | source code
change_style(self, token, style) Generate output to change from existing style to another style only. | source code
Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Class Variables | [hide private]
| all_styles = ``{``'``C``'``:` `(`<function c_tokenizer at 0x2af5fd2728c0>`,` `...``

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, mode, link=global_settings.applications_parent, styles=global_settings.applications_parent) (Constructor) | source code
    Initialise highlighter:
        mode = language (PYTHON, WEB2PY,C, CPP, HTML, HTML_PLAIN)
Overrides: object.__init__

### highlight(self, data) | source code
Syntax highlight some python code. Returns html version of code.

Class Variable Details | [hide private]

  ### all_styles Value:
      {'C': (<function c_tokenizer at 0x2af5fd2728c0>,
             (('COMMENT',
               re.compile(r'//.*\r?\n'),
               'color: green; font-style: italic'),
              ('MULTILINECOMMENT',
               re.compile(r'(?s)/\*.*?\*/'),
               'color: green; font-style: italic'),
              ('PREPROCESSOR', re.compile(r'(?s)\s*#.*?[^\\]\s*\n'), 'color:
      ...