handle code blocks and hilited code blocks
This commit is contained in:
parent
af210c27f2
commit
026dad0959
2 changed files with 20 additions and 10 deletions
|
@ -12,3 +12,19 @@ Normal text, ''emphasized'', '''strong''', __underline__, ,,subscript,,, ^supers
|
||||||
|
|
||||||
Normal text, ''emphasized'', '''strong''', __underline__, ,,subscript,,, ^superscript^, `typewriter` and {{{typewriter}}}.
|
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!
|
||||||
|
}}}
|
||||||
|
|
|
@ -194,17 +194,11 @@ class Formatter(FormatterBase):
|
||||||
return apply(FormatterBase.image, (self,), attrs) + '</img>'
|
return apply(FormatterBase.image, (self,), attrs) + '</img>'
|
||||||
|
|
||||||
def code_area(self, on, code_id, code_type='code', show=0, start=-1, step=-1):
|
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):
|
def code_line(self, on):
|
||||||
return ('<codeline>', '</codeline')[not on]
|
return ('', '\n')[on]
|
||||||
|
|
||||||
def code_token(self, on, tok_type):
|
def code_token(self, on, tok_type):
|
||||||
return ('<codetoken type="%s">' % tok_type, '</codetoken')[not on]
|
# not supported
|
||||||
|
return ''
|
||||||
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]
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue