fix: latex compile error on build

This commit is contained in:
relikd
2023-03-03 23:10:31 +01:00
parent a292f4116a
commit 3c244b2e5a
2 changed files with 8 additions and 9 deletions

View File

@@ -5,7 +5,6 @@ import os
import re import re
import shutil # which, copyfile, rmtree import shutil # which, copyfile, rmtree
import subprocess as shell # run, DEVNULL import subprocess as shell # run, DEVNULL
from weakref import ref
from typing import TYPE_CHECKING, List, Tuple, Generator from typing import TYPE_CHECKING, List, Tuple, Generator
if TYPE_CHECKING: if TYPE_CHECKING:
from lektor.builder import Artifact, Builder, BuildState from lektor.builder import Artifact, Builder, BuildState
@@ -192,7 +191,7 @@ class TexSources:
except AttributeError: except AttributeError:
refs = list() refs = list()
builder.__tex_files = refs # type: ignore[attr-defined] builder.__tex_files = refs # type: ignore[attr-defined]
refs.append(ref(record)) refs.append(record)
@staticmethod @staticmethod
def build(builder: 'Builder') -> None: def build(builder: 'Builder') -> None:
@@ -209,7 +208,7 @@ class TexSources:
msg = f'PDF builder ({TEXER})' msg = f'PDF builder ({TEXER})'
with Log.group(msg, builder): with Log.group(msg, builder):
for rec_ref in sources: for rec_ref in sources:
builder.build(PdfSource(rec_ref())) builder.build(PdfSource(rec_ref))
# ---------------------------------------------------- # ----------------------------------------------------

View File

@@ -23,7 +23,7 @@
{# recipe title (start on new page) #} {# recipe title (start on new page) #}
\newrecipe{ {{- recipe._slug -}} }{ {{- recipe.name | latexStr -}} } \newrecipe{ {{- recipe._slug -}} }{ {{- recipe.name | latexStr -}} }
{# duration & yield subtitle -#} {# 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 -#} {# add source link on page footer -#}
\footer{ {{- recipe.source.url | latexStr -}} }{ {{- recipe.source.host | latexStr -}} } \footer{ {{- recipe.source.url | latexStr -}} }{ {{- recipe.source.host | latexStr -}} }
@@ -33,16 +33,16 @@
{%- for ing in recipe.ingredients %} {%- for ing in recipe.ingredients %}
{%- if ing.isGroup %} {%- if ing.isGroup %}
\ingGroup{ {{- ing.name -}} } \ingGroup{ {{- ing.name | latexStr -}} }
{%- else %} {%- else %}
\item[ \item[
{%- if ing.quantity %}{{ ing.quantity }}{% endif -%} {%- if ing.quantity %}{{ ing.quantity | latexStr }}{% endif -%}
{%- if ing.quantity and ing.unit %}~{% endif -%} {%- if ing.quantity and ing.unit %}~{% endif -%}
{%- if ing.unit %}{{ ing.unit }}{% endif -%} {%- if ing.unit %}{{ ing.unit | latexStr }}{% endif -%}
] \ingName{ {{- ing.name or '' -}} } ] \ingName{ {{- ing.name or '' | latexStr -}} }
{%- if ing.note -%} {%- if ing.note -%}
\ingDetail{ \ingDetail{
{%- for word in ing.note.split() -%} {%- for word in (ing.note | latexStr).split() -%}
{#- detect recipe reference links -#} {#- detect recipe reference links -#}
{%- if word.startswith('@') %} \pagelink{ {{- word[4:].rstrip('/') -}} } {%- if word.startswith('@') %} \pagelink{ {{- word[4:].rstrip('/') -}} }
{#- or copy unchanged -#} {#- or copy unchanged -#}