prototyping table generator

This commit is contained in:
Hartmut Seichter 2023-11-19 23:17:44 +01:00
parent 4105eb917b
commit 021a0f69d3
5 changed files with 43 additions and 2 deletions

View file

@ -4,3 +4,4 @@
* [ ] custom python code in tables
* [x] fix overlong table cells (pandoc longtable only deals with overlong tables but not cells)
* [ ] add a book mode for mixing input and headers (# Blah -m mod.cg.yaml)
* [ ] table generator

View file

@ -1,5 +1,6 @@
import token
import string
class TableGenerator:
def __init__(self) -> None:
@ -34,4 +35,36 @@ class TableGenerator:
row.append(' ')
print(' | '.join(row))
self.run_template()
def run_template(self):
t = string.Template(self.get_latex_template())
print(t.substitute({ 'value' : "Test"}))
def get_latex_template(self) -> str:
return (r'\documentclass{article}'
r'\usepackage[utf8]{inputenc}'
r'\usepackage[]{tabularx}'
r'\usepackage[margin=0.7in]{geometry}'
r'\begin{document}'
r'\begin{table}[ht]'
r'\begin{tabular}{l c c}'
r'${value}'
r'\end{tabular}'
r'\end{table}'
r'\end{document}')
#
# Kompetenz & Kennen & Wertung \\
# 1 & Pandoc & +++ \\
# 2 & Latex & ++ \\
# 3 & Writer & +- \\
#
# latex image.tex;dvisvgm image.dvi

View file

@ -1,3 +1,8 @@
#
# demonstrates a coursebook setting
#
book:
- fields:
- name

View file

@ -34,6 +34,8 @@ goal:
bewerten. Sie lernen grundsätzliche Technologien der 3D Echtzeitdarstellung
kennen und wenden diese an.
en: |
Computer graphics is describing all techniques in computer science
generating images perceivable by humans. Participants will have a broad

View file

@ -4,7 +4,7 @@ name:
test:
competency-table:
de:
- "Lineare Algebra": 'ABC'