handle code blocks and hilited code blocks

This commit is contained in:
Elan Ruusamäe 2012-06-20 00:03:43 +02:00
parent af210c27f2
commit 026dad0959
2 changed files with 20 additions and 10 deletions

View file

@ -12,3 +12,19 @@ Normal text, ''emphasized'', '''strong''', __underline__, ,,subscript,,, ^supers
Normal text, ''emphasized'', '''strong''', __underline__, ,,subscript,,, ^superscript^, `typewriter` and {{{typewriter}}}.
== Syntax Highlighting ==
{{{#!python
# python code
print code.colorize("abc", 1 + 1)
# third line
# fourth line
}}}
{{{
plain
multiline block
with some ''text'' in it
fourth line
sixth line!
}}}

View file

@ -194,17 +194,11 @@ 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 ('<codearea id="%s">' % code_id, '</codearea')[not on]
return ('<code>', '</code>')[not on]
def code_line(self, on):
return ('<codeline>', '</codeline')[not on]
return ('', '\n')[on]
def code_token(self, on, tok_type):
return ('<codetoken type="%s">' % tok_type, '</codetoken')[not on]
def code_line(self, on):
return ('<codeline>', '</codeline')[not on]
def code_token(self, on, tok_type):
return ('<codetoken type="%s">' % tok_type, '</codetoken')[not on]
# not supported
return ''