just cleanup
This commit is contained in:
parent
010aa5e72f
commit
0a5db9f8ad
2 changed files with 14 additions and 12 deletions
|
@ -7,7 +7,7 @@ import os
|
|||
|
||||
class TableGenerator:
|
||||
"""
|
||||
Really hacky method to create latex > dvi > SVG to create images to include
|
||||
Really hacky method to create latex > dvi > SVG to create images to include
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
|
@ -22,7 +22,7 @@ class TableGenerator:
|
|||
|
||||
for token in data.split(','):
|
||||
|
||||
t = tuple(token.split(':')[:2])
|
||||
t = tuple(token.split(':')[:2])
|
||||
row = [t[0]]
|
||||
for k in list(self.__cols_map[lang].keys())[1:]:
|
||||
if k in t[1]:
|
||||
|
@ -33,10 +33,10 @@ class TableGenerator:
|
|||
rows.append(' & '.join(row) + '\\\\')
|
||||
|
||||
self.run_template(rows=rows)
|
||||
|
||||
|
||||
def run_template(self,rows = [],lang = 'de'):
|
||||
|
||||
|
||||
def run_template(self,rows = [],lang = 'de') -> None:
|
||||
|
||||
t = string.Template(self.get_latex_template())
|
||||
|
||||
with tempfile.NamedTemporaryFile('w',delete=False,prefix='cb-') as fp:
|
||||
|
@ -45,7 +45,7 @@ class TableGenerator:
|
|||
subprocess.run(["latex",fp.name])
|
||||
subprocess.run(["dvisvgm",os.path.basename(fp.name) + '.dvi'])
|
||||
# subprocess.run(["mv",os.path.basename(fp.name) + '.svg','.'])
|
||||
|
||||
|
||||
|
||||
|
||||
def get_latex_template(self,lang = 'de') -> str:
|
||||
|
@ -63,7 +63,7 @@ class TableGenerator:
|
|||
r'\begin{table}[ht]' +
|
||||
'\\begin{{tabular}} {{ {0} }}'.format(' '.join(layout)) +
|
||||
r'\hline'
|
||||
r' ${th}'
|
||||
r' ${th}'
|
||||
r'\hline'
|
||||
r' ${td}' +
|
||||
r'\hline'
|
||||
|
@ -71,7 +71,7 @@ class TableGenerator:
|
|||
r'\end{table}'
|
||||
r'\end{document}')
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Kompetenz & Kennen & Wertung \\
|
||||
|
||||
|
@ -79,4 +79,4 @@ class TableGenerator:
|
|||
# 2 & Latex & ++ \\
|
||||
# 3 & Writer & +- \\
|
||||
#
|
||||
# latex image.tex;dvisvgm image.dvi
|
||||
# latex image.tex;dvisvgm image.dvi
|
||||
|
|
|
@ -11,18 +11,20 @@ table.de.pdf:
|
|||
|
||||
all: table.en.pdf table.de.pdf
|
||||
|
||||
clean:
|
||||
clean:
|
||||
rm -f table.en.pdf table.de.pdf
|
||||
|
||||
debug-template:
|
||||
python ${coursebuilder} -s schema.yaml -m mod.cg.yaml mod.interactsys.yaml -l de -f name credits --template "$$name | $$credits"
|
||||
|
||||
debug-markdown:
|
||||
python ${coursebuilder} -s schema.yaml -m mod.cg.yaml mod.interactsys.yaml -l de -f name credits
|
||||
python ${coursebuilder} -s schema.yaml -m mod.cg.yaml mod.interactsys.yaml -l de -f name credits
|
||||
|
||||
debug-book:
|
||||
python ${coursebuilder} -s schema.yaml -b book.yaml -l de
|
||||
python ${coursebuilder} -s schema.yaml -b book.yaml -l de
|
||||
|
||||
debug:
|
||||
python ${coursebuilder} -s schema.yaml -m mod.cg.yaml -l de -f fields.yaml
|
||||
|
||||
table:
|
||||
python ${coursebuilder} -s schema.yaml -b book.yaml -l de -f fields.yaml
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue