From: Michael Wagner Date: Tue, 26 May 2020 17:21:26 +0000 (+0200) Subject: pydev-ts X-Git-Tag: mdoku_0.1-0~5 X-Git-Url: http://wagnertech.de/git?p=mDoc.git;a=commitdiff_plain;h=596f28b2ecf6b1f371c8e71f702697f391af929b pydev-ts --- 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"]: diff --git a/python/mDoc/tpl/latex.tpl b/python/mDoc/tpl/latex.tpl index ee432c3..8068863 100644 --- a/python/mDoc/tpl/latex.tpl +++ b/python/mDoc/tpl/latex.tpl @@ -3,6 +3,8 @@ expected in : "+elem) - (ctl2,elem, value, attrs) = source.extractElement(XMLE.EC_BEG) # reads entry + (ctl2,elem, value,attrs) = source.extractElement(XMLE.EC_BEG) # reads entry entry_sep = "" while ctl2 != XMLE.EC_END: + if not value: + value = "" if elem != "entry": raise RuntimeError("Only expected in : "+elem) + # check for further elems + (ctl3,elem,value3,attrs3) = source.extractElement(XMLE.EC_BEG) + line_sep = "" + while ctl3 != XMLE.EC_END: + if elem != "line": # only lines expected + raise RuntimeError("Only expected in + + + +
testdata @@ -56,6 +84,7 @@ while ctl != XMLE.EC_END: \geometry{a4paper,left=25mm,right=20mm, top=33mm, bottom=30mm} \renewcommand{\familydefault}{\sfdefault} +\renewcommand{\arraystretch}{1.4} \author{Michael J.M. Wagner}