~sthagen/liitos#48: 
Bug in label injector where figure parsing leaves out log points

In version 2023.10.5+parent.g7bf1feaa, liitos when given a figure and a mermaid auto generated image the filter for the stem label injector seem to remove all lines following the first mermaid includegraphics line (including that line).

The log is something like (the hash escapes are a workaround to not have the todo renderer here display todo ids and URLs):

INFO: inject stem (derived from file name) labels ...
INFO: start of a figure environment at line \#3
INFO: within a figure environment at line \#23
INFO: \includegraphics{images/some-mermaid.png}
INFO: \label{fig:some-mermaid}
INFO: diff of the (inject-stem-derived-labels) filter result:

In the log I would have expected instead something like this:

INFO: inject stem (derived from file name) labels ...
INFO: start of a figure environment at line \#3
INFO: within a figure environment at line \#5
INFO: \includegraphics[width=0.6\textwidth,height=\textheight]{images/wun.png}
INFO: \label{fig:wun}
INFO: - found the caption start at line \#6
INFO: end of figure env detected at line \#7
WARN: graphics include outside of a figure environment at line \#23
ERRO: line\#23|\includegraphics{images/some-mermaid.png}
INFO: trying to fix temporarily ... watch for marker MISSING-CAPTION-IN-MARKDOWN
INFO: \label{fig:some-mermaid}
INFO: diff of the (inject-stem-derived-labels) filter result:

And effectively setting captain to "Some Caption for a Mermaid" and thus replacing the single line 23 content with:

\begin{figure}
\centering')
\includegraphics{images/some-mermaid.png}
\caption{Some Caption for a Mermaid \label{fig:some-mermaid}}
\end{figure}

To reproduce you can try the following intermediate LaTeX code with label.inject:

Lorem Ipsum 1.

\begin{figure}
\centering
\includegraphics[width=0.6\textwidth,height=\textheight]{images/wun.png}
\caption{Caption wun}
\end{figure}

\newpage

\hypertarget{title-wun}{%
\subsection{Title Wun}\label{title-wun}}

Lorem Ipsum 2.

\hypertarget{title-two}{%
\section{Title Two}\label{title-two}}

Lorem Ipsum 3.

\scale=0.7

\includegraphics{images/some-mermaid.png}

\newpage

Lorem Ipsum 4.

and the following dict for the lookup parameter:

{
  "images/some-mermaid.png": "Some Caption for a Mermaid"
}
Status
RESOLVED FIXED
Submitter
~sthagen
Assigned to
Submitted
1 year, 1 month ago
Updated
1 year, 1 month ago
Labels
Bug

~sthagen REPORTED FIXED 1 year, 1 month ago

Fixed per release 2023.11.11

Register here or Log in to comment, or comment via email.