Skip to content
Snippets Groups Projects
Commit e5408a22 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Show decision categories in the tex protocol

/close #92
parent a56530e0
Branches
No related tags found
No related merge requests found
...@@ -213,6 +213,11 @@ class Tag: ...@@ -213,6 +213,11 @@ class Tag:
if not show_private: if not show_private:
return "" return ""
return self.todo.render_latex(current_protocol=protocol) 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))) return r"\textbf{{{}:}} {}".format(escape_tex(self.name.capitalize()), escape_tex(";".join(self.values)))
elif render_type == RenderType.plaintext: elif render_type == RenderType.plaintext:
if self.name == "url": if self.name == "url":
......
...@@ -285,6 +285,7 @@ def parse_protocol_async_inner(protocol, encoded_kwargs): ...@@ -285,6 +285,7 @@ def parse_protocol_async_inner(protocol, encoded_kwargs):
protocol.decisions.remove(decision) protocol.decisions.remove(decision)
db.session.commit() db.session.commit()
decision_tags = [tag for tag in tags if tag.name == "beschluss"] decision_tags = [tag for tag in tags if tag.name == "beschluss"]
decisions_to_render = []
for decision_tag in decision_tags: for decision_tag in decision_tags:
if len(decision_tag.values) == 0: if len(decision_tag.values) == 0:
error = protocol.create_error("Parsing", "Empty decision found.", error = protocol.create_error("Parsing", "Empty decision found.",
...@@ -320,6 +321,9 @@ def parse_protocol_async_inner(protocol, encoded_kwargs): ...@@ -320,6 +321,9 @@ def parse_protocol_async_inner(protocol, encoded_kwargs):
content=decision_content, category_id=decision_category_id) content=decision_content, category_id=decision_category_id)
db.session.add(decision) db.session.add(decision)
db.session.commit() 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_top = decision_tag.fork.get_top()
decision_content = texenv.get_template("decision.tex").render( decision_content = texenv.get_template("decision.tex").render(
render_type=RenderType.latex, decision=decision, render_type=RenderType.latex, decision=decision,
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
\begin{itemize} \begin{itemize}
\ENV{if protocol.decisions|length > 0} \ENV{if protocol.decisions|length > 0}
\ENV{for decision in protocol.decisions} \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{endfor}
\ENV{else} \ENV{else}
\item Keine Beschlüsse \item Keine Beschlüsse
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment