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

Class Highlighter

source code

object --+
         |
        Highlighter

Does syntax highlighting.

Instance Methods [hide private]
 
__init__(self, mode, link=None, styles=None)
Initialize 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__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  all_styles = {'C': (<function c_tokenizer at 0x2610938>, (('CO...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, mode, link=None, styles=None)
(Constructor)

source code 

Initialize 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 0x2610938>,
       (('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:\
...