Here is an example of highlighting sections of Python code. |
If a link value is specified, for example "/examples/global/vars/", web2py API references in the code are linked to documentation at the link URL.
CODE("print 'hello world'", link=None)
CODE("print 'hello world'", language='python')
The counter argument is used for line numbering. It can be set to any of three different values. It can be None for no line numbers, a numerical value specifying the start number, or a string. If the counter is set to a string, it is interpreted as a prompt, and there are no line numbers.
CODE("print 'hello world'", language='python', link=None, counter=1)
{{=CODE(...,styles={'CODE':'margin: 0;padding: 5px;border: none;'})}}
{{=CODE(context_line=False,
styles={
'LINENUMBERS':'visibility: hidden;'
,'CODE':'font-size: 14px; background-color: transparent;margin: 0 0 0 -40px; padding: 5px 10px 10px 10px;border: none;verflow: auto;white-space: pre !important;'
})}}
This argument highlights the line.
{{=CODE(reference.code, language='web2py', link=None, counter=None,context_line=False
" Web2py Book"