title variable should not be interpreted as block element
nichtich opened this issue · 4 comments
The title variable (and similar "inline-value" variables) should never be interpreted as block element. Try this example:
---
title: "6. conference"
...
report
converted with pandoc -s -t latex
the output contains:
\title{\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{5}
\itemsep1pt\parskip0pt\parsep0pt
\item
conference
\end{enumerate}}
instead of \title{6. conference}
. I stumbled upon this because 5. xxx
in German is used like 6th xxx
in English. Similar for unnumbered lists:
---
title: "* is a star"
...
I realize that this is confusing, but let me explain why it happens.
Pandoc treats all fields in YAML blocks as potentially containing
block-level content. Clearly this is desirable in general; an abstract,
for example, might contain a list. You can avoid the undesirable
behavior in your case by using backslash escapes, e.g. 6\. conference
.
It might be worth considering giving the title
field special
treatment, since it does have a special role in some document formats,
and has a place in all of the default templates. However, I'm also
worried about confusing matters by treating some fields differently
from others (so that users have to know which field gets treated in which
way).
Not sure what the best solution is, but it might be worth raising this
for discussion on pandoc-discuss.
+++ Jakob Voss [Oct 12 14 13:54 ]:
The title variable (and similar "inline-value" variables) shoudl not be interpreted as items. Try this example:
--- title: "6. conference" ... report
converted with
pandoc -s -t latex
the output contains:\title{\begin{enumerate} \def\labelenumi{\arabic{enumi}.} \setcounter{enumi}{5} \itemsep1pt\parskip0pt\parsep0pt \item conference \end{enumerate}}
instead of
\title{6. conference}
. I stumbled upon this because5. xxx
in German is used like6th xxx
in English. Similar for unnumbered lists:--- title: "* is a star" ...
Reply to this email directly or view it on GitHub:
#1685
Ok, it makes sense to treat all metadata fields as Markdown block-level content. Then I'd need an easy way to convert this YAML fields between different formats, especially from/to plain Unicode strings. For instance from
---
title: "6\\. <html> congress"
...
to (plain)
---
title: "6. <html> congress"
...
or (latex)
---
title: "6. \\textless{}html\\textgreater{} congress"
...
Some kind of --yaml-fields
flag in pandoc may help to only convert field values in YAML blocks instead of (or in addition to) the sourrinding Markdown text. Another idea is a --yaml-format
option to explicitly set the format field values are expected in.
I don't understand why you need the conversion to latex for example?