syntax hiliting if available
This commit is contained in:
parent
026dad0959
commit
a8123bee1a
2 changed files with 15 additions and 1 deletions
|
@ -20,6 +20,10 @@ print code.colorize("abc", 1 + 1)
|
|||
# fourth line
|
||||
}}}
|
||||
|
||||
{{{#!cplusplus
|
||||
foo = new something(1, "soo\nice")
|
||||
}}}
|
||||
|
||||
{{{
|
||||
plain
|
||||
multiline block
|
||||
|
|
|
@ -194,7 +194,17 @@ class Formatter(FormatterBase):
|
|||
return apply(FormatterBase.image, (self,), attrs) + '</img>'
|
||||
|
||||
def code_area(self, on, code_id, code_type='code', show=0, start=-1, step=-1):
|
||||
return ('<code>', '</code>')[not on]
|
||||
syntax = ''
|
||||
# switch for Python: http://simonwillison.net/2004/may/7/switch/
|
||||
try:
|
||||
syntax = {
|
||||
'ColorizedPython': 'python',
|
||||
'ColorizedCPlusPlus': 'cpp',
|
||||
}[code_type]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
return ('<code %s>' % syntax , '</code>')[not on]
|
||||
|
||||
def code_line(self, on):
|
||||
return ('', '\n')[on]
|
||||
|
|
Loading…
Reference in a new issue