zim-wiki team mailing list archive
-
zim-wiki team
-
Mailing list archive
-
Message #02758
Zim dokuwiki syntax, pandoc converting latex and pdf with line number!
Hi,
Do you know the amazing pandoc? A multi text format converter.
http://johnmacfarlane.net/pandoc/
But it doesn't support dokuwiki yet...
Zim's manual said: "Most of this syntax is inspired by the dokuwiki syntax"
I'm playing to auto build a PDF passing a filter with Latex's magic
inside. (numbering lines!) :-D
I first tested pandoc directly on the .txt.
simple PDF export (does require heavy package install under xubuntu ~
350MB or more)
sudo apt-get install texlive-fonts-recommended pandoc texlive-latex-extra
$ sed '1,7 d' 01.chapter.txt | pandoc -S -o out.pdf
Works great even with special characters « » - ...
The .tex export from zim in Article template doesn't compile with such char.
zim --export --output=o.tex --format=latex --template=Article
~/Notebook/Novel ":Novel:01.chapter 1"
My first tests used almost no zim formating. This is for novel writing.
I tested my formater against zim documentation.
This formater use a modified .tex output and a \usepackage{eledmac}
(many more MB of deb packages required to make it work) which counts
line number in the generated pdf!
Really cool...
the part of the code which adds the latex macro for numbering lines
looks like:
# remove Zim's header, convert speaker part too
sed -e '1,4 d' "$source_page" -e '/^--- / a\\n' \
| pandoc -s -o "${basepage}.tex"
# edit inplace -i
sed -i -e '/^\\usepackage{fixltx2e}/ a\\\usepackage{eledmac}' \
-e '/^\\begin{document}/
a\\\begingroup\n\\beginnumbering\n\\autopar '\
-e '/^\\end{document}/ i\\\endnumbering\n\\endgroup' \
"${basepage}.tex"
latex "${basepage}.tex"
dvipdf "${basepage}.dvi"
See this generated pdf for an example. As you can see the format is broken.
30 days link: http://dl.free.fr/fniKVY1ou
So, I've a question. Which Latex converter should I use?
Hacking the Zim's export template? or filter the txt file to some more
pandoc friendly syntax?
Regards,
Sylvain.
Follow ups