def SublanguageHandler(args, doc, renderer):
    code = doc.reconstruct_child_text().as_string()
    literalfragment = Inline.LiteralFragment(code)
    if Config.code_enscript_command:
	filename = os.tmpnam()
	file = open(filename, 'w+')
	file.write(code)
	file.close()
	command = Config.code_enscript_command + ' -B -p - --language=html --color -E' + \
	    args + ' ' + filename + ' 2>/dev/null'
	child_stdout = os.popen(command)
	result = child_stdout.read()
	child_stdout.close()
	os.unlink(filename)
        renderer.add(HighlightedCode(Inline.HtmlFragment(enscriptre.sub(r'\1', result)),
                                     literalfragment))
    else:
	renderer.add(HighlightedCode(literalfragment, literalfragment))
def SpanHandler(rest, acc):
    (inner, rest) = Inline.collectSpan(rest)
    acc.append(Inline.HtmlFragment(inner))
    return rest
Exemplo n.º 3
0
def SublanguageHandler(args, doc, renderer):
    renderer.add(Inline.HtmlFragment(doc.reconstruct_child_text().as_string()))