I try to make my evoque templates color-code a bit, but the html I get is already escaped with lt-gt's
I read there should be something like a quoted-no-more class but I haven't been able to find the evoque.quoted package
My aim is to not have escaped html coming out of the template, but 'real'.
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import HtmlFormatter
from evoque.domain import Domain
import os
tmpl="""
$begin{code}
${codyfy(evoque(name=label), lang=label.split()[0][1:])}
$end{code}
$begin{c 0}
int main(void){printf("hello world");return 0;}
$end{c 0}
$begin{python 0}
print "hello world"
$end{python 0}
$evoque{#code, label="#c 0"}
$evoque{#code, label="#python 0"}
"""
td = Domain(os.path.abspath("."))
def codyfy(src,lang="python"):
return highlight(src,get_lexer_by_name(lang, stripall=True),HtmlFormatter())
td.set_on_globals('codyfy',codyfy)
td.set_template("testtmpl", src=tmpl, from_string=True)
t = td.get_template("testtmpl")
print t.evoque()