From 2bfcd4dd35afb85f25e489bb6e5f57a246e5b461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Sun, 30 Oct 2022 18:47:10 +0100 Subject: [PATCH] Fix encoding and LaTeX issues --- repartir_taches/templates/category.tex.j2 | 4 ++++ repartir_taches/templates/repartition.tex.j2 | 5 +++-- repartir_taches/util.py | 3 ++- taches.yml | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/repartir_taches/templates/category.tex.j2 b/repartir_taches/templates/category.tex.j2 index 6b6e187..1605f15 100644 --- a/repartir_taches/templates/category.tex.j2 +++ b/repartir_taches/templates/category.tex.j2 @@ -1,6 +1,10 @@ {% if cat|attr('depth') %} \{%- for i in range(cat.depth-1) -%}sub{%- endfor -%}category{ {{- cat.name -}} }{ {{- cat.time -}} } + {%- if cat.intro -%} + {{- cat.intro|md_format|escape_latex -}} + {% endif %} + {% for cat in cat.tasks %} {% include 'category.tex.j2' %} {% endfor %} diff --git a/repartir_taches/templates/repartition.tex.j2 b/repartir_taches/templates/repartition.tex.j2 index 2efc8df..4a3639e 100644 --- a/repartir_taches/templates/repartition.tex.j2 +++ b/repartir_taches/templates/repartition.tex.j2 @@ -3,10 +3,11 @@ \usepackage[margin=1.5cm]{geometry} \usepackage[dvipsnames]{xcolor} -\usepackage[T1]{fontenc} +\usepackage{fontspec} \usepackage[fontsize=14pt]{fontsize} \usepackage[framemethod=tikz]{mdframed} \usepackage[most]{tcolorbox} +\usepackage[french]{babel} \title{\vspace{-1.5cm}Répartition des tâches} \author{} @@ -42,7 +43,7 @@ \begin{document} \maketitle - \section*{Groupes} + \section*{Groupes\hfill{}{\normalsize Chaque groupe a plusieurs tâches~!}} \begin{tabular}{c l l l l l} {% for g_id, _ in groupes.items() %} diff --git a/repartir_taches/util.py b/repartir_taches/util.py index f290fc3..0fa51fe 100644 --- a/repartir_taches/util.py +++ b/repartir_taches/util.py @@ -100,11 +100,12 @@ def md_format(val: str) -> str: return val -_TEX_NBSP = re.compile(r" ([?!])") +_TEX_NBSP = re.compile(r" ([?!:])") def escape_latex(val: str) -> str: val = _TEX_NBSP.sub(r"~\1", val) + val = val.replace("·", r"$\cdot$") return val.replace("&", r"\&") diff --git a/taches.yml b/taches.yml index 41dcf6d..7579ed6 100644 --- a/taches.yml +++ b/taches.yml @@ -31,7 +31,7 @@ taches: - nom: Installer tables descr: "Arranger tables & chaises pour {nbChoristesDiner} personnes" - nom: Mettre la table - descr: "Mettre la table — vaisselle, couverts, etc." + descr: "Mettre la table -- vaisselle, couverts, etc." - nom: Service descr: "Servir l'apéro, le repas, le dessert" - nom: Débarrasser