This solution is not working... The -V $(pandoc...) commands output
contains characters that are control characters for bash, so the command
cannot be launched like that.
Example:
$ pandoc --template odt.template main.md -t opendocument -o my.odt -V s1=$(
pandoc -t opendocument -f markdown sections/section1.md ) -V s2=$( pandoc -t
opendocument -f markdown sections/section2.md ) -V s3=$( pandoc -t
opendocument -f markdown sections/section3.md )
pandoc: text:style-name="Heading_20_1": openFile: does not exist (No such
file or directory)
The same, but with the debug enabled:
$ set -x
$ pandoc --template odt.template main.md -t opendocument -o my.odt -V s1=$(
pandoc -t opendocument -f markdown sections/section1.md ) -V s2=$( pandoc -t
opendocument -f markdown sections/section2.md ) -V s3=$( pandoc -t
opendocument -f markdown sections/section3.md )
++ pandoc -t opendocument -f markdown sections/section1.md
++ pandoc -t opendocument -f markdown sections/section2.md
++ pandoc -t opendocument -f markdown sections/section3.md
+ pandoc --template odt.template main.md -t opendocument -o my.odt -V
's1=Encabezado' '1' 'Encabezado'
'2' 'Encabezado' '3' '' '' 'lista' item '1' ''
'' 'lista' item '2'
'' '' 'lista' item '3' ''
'' -V 's2=Prueba' de
texto en 'Negrita' ,
'cursiva,' 'tachado' y 'mezcla'
'de' 'negrita'
'y' 'negrita' 'cursiva' -V 's3=Prueba' de link: 'I'\''m' an
inline-style link with 'title' Prueba de imagen: '' Prueba de 'código' 'Prueba' de
'código'
pandoc: text:style-name="Heading_20_1": openFile: does not exist (No such
file or directory)
I tryed these ways to get
- Using quotes and scaping quotes in the output of pandoc variable
commands. Like this
pandoc \
--template odt.template \
main.md \
-o my.odt \
-V s1="$( pandoc -t opendocument -f markdown sections/section1.md | sed
's/"/\\"/g')" \
-V s2="$( pandoc -t opendocument -f markdown sections/section2.md | sed
's/"/\\"/g')" \
-V s3="$( pandoc -t opendocument -f markdown sections/section3.md | sed
's/"/\\"/g')"
*Result:* Malformed odt. Quotes keep scaped in contet.xml
- A three steps procedure
- Compose an xml opendocument file, with quotes scaped
- Remove backslashes, unscape quotes
- Generate the odt
$ pandoc \
--template odt.template \
main.md \
-t opendocument \
-o my.odt.xml \
-V s1="$( pandoc -t opendocument -f markdown sections/section1.md | sed
's/"/\\"/g')" \
-V s2="$( pandoc -t opendocument -f markdown sections/section2.md | sed
's/"/\\"/g')" \
-V s3="$( pandoc -t opendocument -f markdown sections/section3.md | sed
's/"/\\"/g')"
$ sed -i -e 's/\\"/"/g' my.odt.xml
$ pandoc --template my.odt.xml main.md -o my.odt
Result: Empty .odt file, but elements in content.xml seem ok??¿!
- Generating a yaml file in order to make pandoc read vars from it,
rather than from the command line and avoid.
Result: In progress... I couldn't make pandoc read markdown from yaml.
However, I'm in doubt about what main.md is... I'm using a just touched
file.
El martes, 26 de abril de 2016, 23:22:51 (UTC+2), John MacFarlane escribió:
>
> There are two things to fiddle with. The --reference-odt,
> which can help with style (spacing, margins, etc.), and
> the opendocument template, which is a place to put hooks
> for content.
>
> You can create a custom opendocument template (use
> 'pandoc -D opendocument' to get the default one).
>
> In place of $body$ you might have, for example,
> $s1$, $s2$, and $s3$, perhaps with some content
> intervening.
>
> You can then use pandoc to fill these variables:
>
> pandoc --template mycustom.opendocument main.md -o my.odt \
> -V s1=$(pandoc -f markdown -t opendocument s1.md
> )
>
> -V s2=$(pandoc -f markdown -t opendocument s2.md)
> -V s3=$(pandoc -f markdown -t opendocument s3.md)
>
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/59292504-c115-4935-b7e2-004c0c875289%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.