diff --git a/syntaxreference.txt b/syntaxreference.txt index 2bba841..ffe329c 100644 --- a/syntaxreference.txt +++ b/syntaxreference.txt @@ -20,6 +20,10 @@ print code.colorize("abc", 1 + 1) # fourth line }}} +{{{#!cplusplus +foo = new something(1, "soo\nice") +}}} + {{{ plain multiline block diff --git a/text_dokuwiki.py b/text_dokuwiki.py index 956cdea..1de78c9 100644 --- a/text_dokuwiki.py +++ b/text_dokuwiki.py @@ -194,7 +194,17 @@ class Formatter(FormatterBase): return apply(FormatterBase.image, (self,), attrs) + '' def code_area(self, on, code_id, code_type='code', show=0, start=-1, step=-1): - return ('', '')[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 ('' % syntax , '')[not on] def code_line(self, on): return ('', '\n')[on]