From a2c8e67ccd7d038f06a77c64ffe6abe400e35a6c Mon Sep 17 00:00:00 2001 From: Benjamin Bertrand Date: Fri, 18 Nov 2016 18:07:38 +0300 Subject: [PATCH] add line_statement_prefix to texenv --- .../generate_bilan/templates/tpl_bilan.tex | 32 +++++++++---------- notes_tools/generate_bilan/texenv.py | 4 +++ 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/notes_tools/generate_bilan/templates/tpl_bilan.tex b/notes_tools/generate_bilan/templates/tpl_bilan.tex index e6e5ef6..ca21044 100644 --- a/notes_tools/generate_bilan/templates/tpl_bilan.tex +++ b/notes_tools/generate_bilan/templates/tpl_bilan.tex @@ -12,7 +12,7 @@ \begin{document} -\Block{for e in students} +%- for e in students \maketitle \begin{minipage}{0.5\linewidth} @@ -39,32 +39,32 @@ \scriptsize \begin{multicols}{3} - \Block{for exo in e["Exercices"]} + %- for exo in e["Exercices"] \begin{tabular}{|p{2cm}|c|} - \Block{if exo["Nom"] in ["Bonus", "Malus", "Presentation"]} - \Block{for _,q in exo["Questions"].iterrows()} - \Block{if q["Mark"]} - \hline - \rowcolor{highlightbg} - \Var{exo["Nom"]} (\Var{q["Question"]}) & \Var{q["Latex_rep"]} \\ - \Block{endif} - \Block{endfor} - \Block{else} + %- if exo["Nom"] in ["Bonus", "Malus", "Presentation"] + %- for _,q in exo["Questions"].iterrows() + %- if q["Mark"] + \hline + \rowcolor{highlightbg} + \Var{exo["Nom"]} (\Var{q["Question"]}) & \Var{q["Latex_rep"]} \\ + %- endif + %- endfor + %- else \hline \rowcolor{highlightbg} Exerice \Var{exo["Nom"]} & \Var{exo["Total"]["Mark"]} / \Var{exo["Total"]["Bareme"]} \\ - \Block{for _,q in exo["Questions"].iterrows()} + %- for _,q in exo["Questions"].iterrows() \hline \Var{q["Question"]} \newline \Var{q["Commentaire"]} & \Var{q["Latex_rep"]} \\ - \Block{endfor} - \Block{endif} + %- endfor + %- endif \hline \end{tabular} -\Block{endfor} +%- endfor \end{multicols} \vfill @@ -77,7 +77,7 @@ \end{center} \normalsize \pagebreak -\Block{endfor} +%- endfor \end{document} diff --git a/notes_tools/generate_bilan/texenv.py b/notes_tools/generate_bilan/texenv.py index c85dca5..69195a5 100644 --- a/notes_tools/generate_bilan/texenv.py +++ b/notes_tools/generate_bilan/texenv.py @@ -12,6 +12,10 @@ texenv = jinja2.Environment( block_end_string = '}', variable_start_string = '\Var{', variable_end_string = '}', + comment_start_string = '\#{', + comment_end_string = '}', + line_statement_prefix = '%-', + line_comment_prefix = '%#', loader = jinja2.PackageLoader("notes_tools.generate_bilan", "templates"), extensions = ['jinja2.ext.do'] )