mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
Digitalisieren der Vorlesung von 06.02.2014; Karteikarten haben nun kein 'Definition XY' mehr
This commit is contained in:
parent
ff24e6c3a1
commit
546a8490c2
7 changed files with 101 additions and 7 deletions
|
@ -7,14 +7,16 @@ def get_definitions(filename):
|
|||
with open(filename) as f:
|
||||
content = f.read()
|
||||
|
||||
pattern = re.compile(r"\\begin{definition}.*?\\end{definition}", re.DOTALL | re.UNICODE)
|
||||
pattern = re.compile(r"\\begin{definition}(.*?)\\end{definition}", re.DOTALL | re.UNICODE)
|
||||
index_pattern = re.compile(r"\\xindex{(?:.*?@)?(.*?)(?:\|.*?)?}", re.UNICODE)
|
||||
todo_pattern = re.compile(r"\\todo{.*?}", re.UNICODE)
|
||||
definitions = re.findall(pattern, content)
|
||||
def_dict_list = []
|
||||
for definition in definitions:
|
||||
names = re.findall(index_pattern, definition)
|
||||
names = map(lambda s: s.replace("!", ", "), names)
|
||||
name = "\\\\".join(names)
|
||||
definition = re.sub(todo_pattern, "", definition)
|
||||
def_dict_list.append({"name":name, "definition":definition})
|
||||
#return "\n\n".join('\\vspace*{{\\fill}}\n{0}\n\\vspace*{{\\fill}}\\clearpage'.format(definition["definition"]) for definition in def_dict_list)
|
||||
return "\n\n".join('\\begin{{flashcard}}{{ {1} }}\n{{ {0} }}\n\\end{{flashcard}}'.format(definition["definition"], definition["name"]) for definition in def_dict_list)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue