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:
|
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:
|
def __init__(self) -> None:
|
||||||
|
@ -22,7 +22,7 @@ class TableGenerator:
|
||||||
|
|
||||||
for token in data.split(','):
|
for token in data.split(','):
|
||||||
|
|
||||||
t = tuple(token.split(':')[:2])
|
t = tuple(token.split(':')[:2])
|
||||||
row = [t[0]]
|
row = [t[0]]
|
||||||
for k in list(self.__cols_map[lang].keys())[1:]:
|
for k in list(self.__cols_map[lang].keys())[1:]:
|
||||||
if k in t[1]:
|
if k in t[1]:
|
||||||
|
@ -33,10 +33,10 @@ class TableGenerator:
|
||||||
rows.append(' & '.join(row) + '\\\\')
|
rows.append(' & '.join(row) + '\\\\')
|
||||||
|
|
||||||
self.run_template(rows=rows)
|
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())
|
t = string.Template(self.get_latex_template())
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile('w',delete=False,prefix='cb-') as fp:
|
with tempfile.NamedTemporaryFile('w',delete=False,prefix='cb-') as fp:
|
||||||
|
@ -45,7 +45,7 @@ class TableGenerator:
|
||||||
subprocess.run(["latex",fp.name])
|
subprocess.run(["latex",fp.name])
|
||||||
subprocess.run(["dvisvgm",os.path.basename(fp.name) + '.dvi'])
|
subprocess.run(["dvisvgm",os.path.basename(fp.name) + '.dvi'])
|
||||||
# subprocess.run(["mv",os.path.basename(fp.name) + '.svg','.'])
|
# subprocess.run(["mv",os.path.basename(fp.name) + '.svg','.'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_latex_template(self,lang = 'de') -> str:
|
def get_latex_template(self,lang = 'de') -> str:
|
||||||
|
@ -63,7 +63,7 @@ class TableGenerator:
|
||||||
r'\begin{table}[ht]' +
|
r'\begin{table}[ht]' +
|
||||||
'\\begin{{tabular}} {{ {0} }}'.format(' '.join(layout)) +
|
'\\begin{{tabular}} {{ {0} }}'.format(' '.join(layout)) +
|
||||||
r'\hline'
|
r'\hline'
|
||||||
r' ${th}'
|
r' ${th}'
|
||||||
r'\hline'
|
r'\hline'
|
||||||
r' ${td}' +
|
r' ${td}' +
|
||||||
r'\hline'
|
r'\hline'
|
||||||
|
@ -71,7 +71,7 @@ class TableGenerator:
|
||||||
r'\end{table}'
|
r'\end{table}'
|
||||||
r'\end{document}')
|
r'\end{document}')
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Kompetenz & Kennen & Wertung \\
|
# Kompetenz & Kennen & Wertung \\
|
||||||
|
|
||||||
|
@ -79,4 +79,4 @@ class TableGenerator:
|
||||||
# 2 & Latex & ++ \\
|
# 2 & Latex & ++ \\
|
||||||
# 3 & Writer & +- \\
|
# 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
|
all: table.en.pdf table.de.pdf
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f table.en.pdf table.de.pdf
|
rm -f table.en.pdf table.de.pdf
|
||||||
|
|
||||||
debug-template:
|
debug-template:
|
||||||
python ${coursebuilder} -s schema.yaml -m mod.cg.yaml mod.interactsys.yaml -l de -f name credits --template "$$name | $$credits"
|
python ${coursebuilder} -s schema.yaml -m mod.cg.yaml mod.interactsys.yaml -l de -f name credits --template "$$name | $$credits"
|
||||||
|
|
||||||
debug-markdown:
|
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:
|
debug-book:
|
||||||
python ${coursebuilder} -s schema.yaml -b book.yaml -l de
|
python ${coursebuilder} -s schema.yaml -b book.yaml -l de
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
python ${coursebuilder} -s schema.yaml -m mod.cg.yaml -l de -f fields.yaml
|
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