jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.03k stars 3.35k forks source link

Variables not used correctly in restructuredtext files #2986

Closed stooj closed 8 years ago

stooj commented 8 years ago

Including a yaml file with an rst file does not work correctly

To reproduce -

test.rst

This is the story of our first teacher

variables.yaml


---
title: A title

---

Command:

pandoc -s -o test.pdf test.rst variables.yaml

Output:

2016-06-18-173854_620x240_scrot

For reference, if I parse the input with markdown, it works

Command:

pandoc -s -o test2.pdf -f markdown test.rst variables.yaml

Output: 2016-06-18-173833_620x240_scrot

Pandoc version:

pandoc 1.15.2
Compiled with texmath 0.8.4, highlighting-kate 0.6.
Syntax highlighting is supported for the following languages:
    abc, actionscript, ada, agda, apache, asn1, asp, awk, bash, bibtex, boo, c,
    changelog, clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css,
    curry, d, diff, djangotemplate, dockerfile, dot, doxygen, doxygenlua, dtd,
    eiffel, email, erlang, fasm, fortran, fsharp, gcc, glsl, gnuassembler, go,
    haskell, haxe, html, idris, ini, isocpp, java, javadoc, javascript, json,
    jsp, julia, kotlin, latex, lex, lilypond, literatecurry, literatehaskell,
    lua, m4, makefile, mandoc, markdown, mathematica, matlab, maxima, mediawiki,
    metafont, mips, modelines, modula2, modula3, monobasic, nasm, noweb,
    objectivec, objectivecpp, ocaml, octave, opencl, pascal, perl, php, pike,
    postscript, prolog, pure, python, r, relaxng, relaxngcompact, rest, rhtml,
    roff, ruby, rust, scala, scheme, sci, sed, sgml, sql, sqlmysql,
    sqlpostgresql, tcl, tcsh, texinfo, verilog, vhdl, xml, xorg, xslt, xul,
    yacc, yaml, zsh
Default user data directory: /home/stooj/.pandoc
Copyright (C) 2006-2015 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
mb21 commented 8 years ago

pandoc test.rst variables.yaml simply concatenates the two files. But in RST, the metadata fields don't follow the YAML format (as opposed to markdown) and are called bibliographic fields. For example:

================================
 reStructuredText Test Document
================================

:Author: David Goodger

document text...

Alternatively, you could just supply pandoc with the variables directly: pandoc -V title="my title" -s -f rst test.rst

jgm commented 8 years ago

This is right. YAML metadata is a feature of pandoc's extended Markdown dialect; it doesn't work with RST (though you can use RST methods to specify these things in RST).

ZelphirKaltstahl commented 7 years ago

@mb21 However, the bibliographic fields listed on that page do not cover all the things one can write in the YAML metadata in Pandoc Markdown – That's a problem and needs to be circumvented in other ways. I don't see a way to specify keywords for example, which is very important for PDFs.