web2py.gluon.html.CODE

Package web2py :: Package gluon :: Module html :: Class CODE |
[hide private]
[frames] | no frames]

# Class CODE

source code

      object --+
               |
    XmlComponent --+
                   |
                 DIV --+
                       |
                      CODE

displays code in HTML with syntax highlighting.

:param attributes: optional attributes:

- language: indicates the language, otherwise PYTHON is assumed
- link: can provide a link
- styles: for styles

Example:

       {{=CODE("print 'hello world'", language='python', link=None,
           counter=1, styles={}, highlight_line=None)}}

supported languages are "python", "html_plain", "c", "cpp", "web2py", "html". The "html" language interprets {{ and }} tags as "web2py" code, "html_plain" doesn't.

if a link='/examples/global/vars/' is provided web2py keywords are linked to the online docs.

the counter is used for line numbering, counter can be None or a prompt string.

Instance Methods | [hide private]
xml(self) generates the xml for this component. | source code
Inherited from `DIV`: `__delitem__`, `__getitem__`, `__init__`, `__len__`, `__nonzero__`, `__setitem__`, `__str__`, `append`, `element`, `elements`, `flatten`, `insert`, `sibling`, `siblings`, `update` Inherited from `DIV` (private): `_fixup`, `_postprocessing`, `_setnode`, `_traverse`, `_validate`, `_wrap_components`, `_xml` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`

Class Variables | [hide private]
Inherited from `DIV`: `regex_attr`, `regex_class`, `regex_id`, `regex_tag`, `tag`

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

Method Details | [hide private]

### xml(self) | source code
generates the xml for this component. Overrides: DIV.xml (inherited documentation)