9999years / latex-changelog

LaTeX package for typesetting changelogs
https://ctan.org/pkg/changelog
LaTeX Project Public License v1.3c
9 stars 3 forks source link

Valid string seems not parsed correctly #5

Closed blaggacao closed 4 years ago

blaggacao commented 4 years ago

Let's consider the following inimal metadata yaml:

---
history:
  - v: 0.4.3
    date: 2020-03-13
    changes: foo, bar
---

(which I use in pandoc and seems correctly parsed to pandoc native using pandoc -f markdown -t native -s metadata.yaml | sed '$ d' > metadata.native trick )

Pandoc (Meta {unMeta = fromList [
    ("history",MetaList [MetaMap (fromList [
        ("changes",MetaInlines [Str "foo,",Space,Str "bar"]),
        ("date",MetaInlines [Str "2020-03-13"]),
        ("v",MetaInlines [Str "0.4.3"])])])]})

when piping through:

\begin{changelog}[author=$author$, section=false]
$for(history)$
  $if(history.author)$
    \shortversion{v=$history.v$, author=$history.author$, date=$history.date$, changes=$history.changes$}
  $else$
    \shortversion{v=$history.v$, date=$history.date$, changes=$history.changes$}
  $endif$
$endfor$
\end{changelog}

I get

! Package xkeyval Error: `bar' undefined in families `version'.

See the xkeyval package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.171 ...0.4.2, date=2020-03-12, changes=foo, bar}
blaggacao commented 4 years ago

A trained eye immediately sees this:

instead of:

changes=$history.changes$

do:

changes={$history.changes$}

@9999years Maybe this could be a hint in the docs? It was kind of hard for me, not being fully used to latex and having it already burrowed deep within the stack.

9999years commented 4 years ago

Sure, I can add a hint when I get a chance. That usage is cool, thanks for sharing! I had no clue people were using this in the wild at all. Forgetting to brace a value containing a comma is an easy-to-make error with keyval interfaces, and LaTeX's error messages do very little to help. Glad you got it figured out!