diff --git a/src/packages/main/lektor_main/latex.py b/src/packages/main/lektor_main/latex.py index 6a739a7..007d46c 100644 --- a/src/packages/main/lektor_main/latex.py +++ b/src/packages/main/lektor_main/latex.py @@ -5,7 +5,6 @@ import os import re import shutil # which, copyfile, rmtree import subprocess as shell # run, DEVNULL -from weakref import ref from typing import TYPE_CHECKING, List, Tuple, Generator if TYPE_CHECKING: from lektor.builder import Artifact, Builder, BuildState @@ -192,7 +191,7 @@ class TexSources: except AttributeError: refs = list() builder.__tex_files = refs # type: ignore[attr-defined] - refs.append(ref(record)) + refs.append(record) @staticmethod def build(builder: 'Builder') -> None: @@ -209,7 +208,7 @@ class TexSources: msg = f'PDF builder ({TEXER})' with Log.group(msg, builder): for rec_ref in sources: - builder.build(PdfSource(rec_ref())) + builder.build(PdfSource(rec_ref)) # ---------------------------------------------------- diff --git a/src/templates/all-recipes-pdf.tex b/src/templates/all-recipes-pdf.tex index 2a90c4e..979f894 100644 --- a/src/templates/all-recipes-pdf.tex +++ b/src/templates/all-recipes-pdf.tex @@ -23,7 +23,7 @@ {# recipe title (start on new page) #} \newrecipe{ {{- recipe._slug -}} }{ {{- recipe.name | latexStr -}} } {# duration & yield subtitle -#} -\meta{ {{- recipe.time | asDuration(this.alt) -}} }{ {{- recipe.yield or '' -}} } +\meta{ {{- recipe.time | asDuration(this.alt) -}} }{ {{- recipe.yield or '' | latexStr -}} } {# add source link on page footer -#} \footer{ {{- recipe.source.url | latexStr -}} }{ {{- recipe.source.host | latexStr -}} } @@ -33,16 +33,16 @@ {%- for ing in recipe.ingredients %} {%- if ing.isGroup %} -\ingGroup{ {{- ing.name -}} } +\ingGroup{ {{- ing.name | latexStr -}} } {%- else %} \item[ - {%- if ing.quantity %}{{ ing.quantity }}{% endif -%} + {%- if ing.quantity %}{{ ing.quantity | latexStr }}{% endif -%} {%- if ing.quantity and ing.unit %}~{% endif -%} - {%- if ing.unit %}{{ ing.unit }}{% endif -%} -] \ingName{ {{- ing.name or '' -}} } + {%- if ing.unit %}{{ ing.unit | latexStr }}{% endif -%} +] \ingName{ {{- ing.name or '' | latexStr -}} } {%- if ing.note -%} \ingDetail{ - {%- for word in ing.note.split() -%} + {%- for word in (ing.note | latexStr).split() -%} {#- detect recipe reference links -#} {%- if word.startswith('@') %} \pagelink{ {{- word[4:].rstrip('/') -}} } {#- or copy unchanged -#}