# 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"]:
<functions>
<function name="informaltable">
<![CDATA[
+# initialize output
+out = ""
# eval colums
(ctl,elem, value, attrs) = source.extractElement(XMLE.EC_BEG) # reads tgroup
if elem != "tgroup":
align = "r"
if attrs["align"] == "left":
align = "l"
-out = r"\begin{tabular}{" + (cols-1)*(align+colsep) + align + "}\n"
+align_arr = cols*[align]
(ctl,elem, value, attrs) = source.extractElement(XMLE.EC_BEG) # searches tbody
while ctl != XMLE.EC_END:
+
+ if elem == "colspec": # colspec found
+ if "colwidth" in attrs:
+ align_arr[int(attrs["colnum"])-1] = "p{"+attrs["colwidth"]+"}"
+
if elem == "tbody": # tbody found
+ out += r"\begin{tabular}{"
+ tmp_colsep = ""
+ for i in range(cols):
+ out += tmp_colsep + align_arr[i]
+ tmp_colsep = colsep
+ out += "}\n"
(ctl1,elem, value, attrs) = source.extractElement(XMLE.EC_BEG) # reads row
while ctl1 != XMLE.EC_END:
if elem != "row":
raise RuntimeError("Only <row> expected in <tbody>: "+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 <entry> expected in <row>: "+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 <line> expected in <entry: "+elem)
+ value += line_sep + value3
+ line_sep = " \par\n"
+ (ctl3,elem3,value3,attrs3) = source.extractElement(ctl3)
out += entry_sep + value
entry_sep = " & "
(ctl2,elem, value, attrs) = source.extractElement(ctl2) # reads entry
out += r" \\" + "\n"
(ctl1,elem, value, attrs) = source.extractElement(ctl1) # reads row
- out += r"\end{tabular}"
+ out += r"\end{tabular}"+"\n\n"
(ctl,elem, value, attrs) = source.extractElement(ctl) # searches tbody
]]></function>
</functions>
<global>
<informaltable exec="informaltable"/>
+<para pre="\n"/>
+<emphasis pre="\emph{" post="}" end=""/>
+<item end=" "/>
</global>
+
<hierarchical>
<article>
<test>testdata</test>
\geometry{a4paper,left=25mm,right=20mm, top=33mm, bottom=30mm}
\renewcommand{\familydefault}{\sfdefault}
+\renewcommand{\arraystretch}{1.4}
\author{Michael J.M. Wagner}