Commit e5408a22 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Show decision categories in the tex protocol

/close #92
parent a56530e0
......@@ -213,6 +213,11 @@ class Tag:
if not show_private:
return ""
return self.todo.render_latex(current_protocol=protocol)
elif self.name == "beschluss":
result = r"\textbf{{Beschluss:}} {}".format(self.decision.content)
if self.decision.category is not None:
result = r"{} \textit{{({})}}".format(result, self.decision.category.name)
return result
return r"\textbf{{{}:}} {}".format(escape_tex(self.name.capitalize()), escape_tex(";".join(self.values)))
elif render_type == RenderType.plaintext:
if self.name == "url":
......
......@@ -285,6 +285,7 @@ def parse_protocol_async_inner(protocol, encoded_kwargs):
protocol.decisions.remove(decision)
db.session.commit()
decision_tags = [tag for tag in tags if tag.name == "beschluss"]
decisions_to_render = []
for decision_tag in decision_tags:
if len(decision_tag.values) == 0:
error = protocol.create_error("Parsing", "Empty decision found.",
......@@ -320,6 +321,9 @@ def parse_protocol_async_inner(protocol, encoded_kwargs):
content=decision_content, category_id=decision_category_id)
db.session.add(decision)
db.session.commit()
decision_tag.decision = decision
decisions_to_render.append((decision, decision_tag))
for decision, decision_tag in decisions_to_render:
decision_top = decision_tag.fork.get_top()
decision_content = texenv.get_template("decision.tex").render(
render_type=RenderType.latex, decision=decision,
......
......@@ -38,7 +38,7 @@
\begin{itemize}
\ENV{if protocol.decisions|length > 0}
\ENV{for decision in protocol.decisions}
\item \VAR{decision.content|escape_tex}
\item \VAR{decision.content|escape_tex}\ENV{if decision.category is not none and show_private} \textit{(\VAR{decision.category.name})}\ENV{endif}
\ENV{endfor}
\ENV{else}
\item Keine Beschlüsse
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment