X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mDoc.git/blobdiff_plain/2f4befafaedd725f179bfdacd10b6d84a44baca4..5968bc04a73fc57ddea666df2fd30fd7228645cc:/python/mDoc/mdoc/worker.py diff --git a/python/mDoc/mdoc/worker.py b/python/mDoc/mdoc/worker.py index a3d7c36..362dd50 100644 --- a/python/mDoc/mdoc/worker.py +++ b/python/mDoc/mdoc/worker.py @@ -46,23 +46,35 @@ def process_file_layer(source, outfile, global_defs, hierarc, functions, target) # proceed working for item in items: if not "position" in item["attrs"]: + # determine line end + end = "\n" + if "end" in item["attrs"]: + end = item["attrs"]["end"] + # check "pre" + if "pre" in item["attrs"]: + text = item["attrs"]["pre"] + if text.startswith(r"\n"): + print (file=outfile) + text = text[2:] + print (text, end="", file=outfile) if "exec" in item["attrs"]: # call function + store_current_node = source.currentNode l = {"out" : None, "source":source} exec(functions[item["attrs"]["exec"]], globals(), l) - #exec('out = "Das kommt von foo()"', globals(), l) + # proceed on previous position + source.currentNode = store_current_node print (l["out"], file=outfile) - # check "pre" - if "pre" in item["attrs"]: - print (item["attrs"]["pre"], end="", file=outfile) - # proceed working - nexthiera = item["items"] - if value: - print (value, end="", file=outfile) - process_file_layer(source, outfile, global_defs, nexthiera, functions, target) + else: + # proceed working + nexthiera = item["items"] + if value: + print (value, end="", file=outfile) + process_file_layer(source, outfile, global_defs, nexthiera, functions, target) # check "post" if "post" in item["attrs"]: print (item["attrs"]["post"], end="", file=outfile) + print (end=end, file=outfile) # search for "last" for item in items: if "position" in item["attrs"]: