Lua filters for pandoc
- installs as a python package for ease of use
pip install pandocker-lua-filters
- Lua filters should be installed under
<sys.prefix>/share/lua/{5.3|5.4}/pandocker
where<sys.prefix>
can be confirmed bypython -c "import sys; print(sys.prefix)"
. It install both 5.3 and 5.4 directories no matter of actual lua versions in system. This<sys.prefix>/share/lua/{5.3|5.4}
should be added topackage.path
which can be confirmed bylua -e "print(package.path)"
.
- requires
aafigure
python package
- requires
csv
andpenlight
luarocks packages - Pandoc below 2.10 applies "simple" filters
csv2table.lua
csv2table-simple.lua
- requires
penlight
luarocks package
- requires
rsvg-convert
in$PATH
- requires
penlight
luarocks package - Pandoc below 2.10 applies "simple" filters
table-width.lua
table-width-simple.lua
- requires
wavedrom-cli
in$PATH
(npm i -g wavedrom-cli
) - requires
lyaml
andlua-cjson2
luarocks packages
Finds unnumbered bullet lists down to 3rd level and applies custom paragraph styles. 4th level and lower list items are escalated to 3rd level.
- Prepare
Bullet List 1
toBullet List 3
paragraph styles (by the way this is 1st level list item)- Otherwise these headers inherit
Body
style (this is 2nd level)
- Otherwise these headers inherit
Level | Unnumbered |
---|---|
1 | Bullet List 1 |
2 | Bullet List 2 |
3+ | Bullet List 3 |
- Adds TOC(Table Of Contents), sub sections, a line break or a page break at any point of document
TOC title is set to "Table of Contents" by default. Metadata toc-title
overrides this setting.
- Makes
appendix
class work to appendix headings in DOCX format - Limited to level-1 to 5 headings
- Prepare
Appendix Heading 1
toAppendix Heading 5
heading styles- Otherwise these headers inherit
Body
style
- Otherwise these headers inherit
Level | Numbered | Unnumbered |
---|---|---|
1 | Heading 1 | Appendix Heading 1 |
2 | Heading 2 | Appendix Heading 2 |
3 | Heading 3 | Appendix Heading 3 |
4 | Heading 4 | Appendix Heading 4 |
5 | Heading 5 | Appendix Heading 5 |
6 | Heading 6 |
- Makes
UnnumberHeadings
class work to unnumber headings in DOCX format - Limited to level-1 to 5 headings
- Prepare
Heading Unnumbered 1
toHeading Unnumbered 5
heading styles- Otherwise these headers inherit
Body
style
- Otherwise these headers inherit
Level | Numbered | Unnumbered |
---|---|---|
1 | Heading 1 | Heading Unnumbered 1 |
2 | Heading 2 | Heading Unnumbered 2 |
3 | Heading 3 | Heading Unnumbered 3 |
4 | Heading 4 | Heading Unnumbered 4 |
5 | Heading 5 | Heading Unnumbered 5 |
6 | Heading 6 |
- Processes only paragraph having single image link
- Blank lines required before and after image link
- Requires
Graphic Anchor
andFigure Caption
paragraph styles in template otherwise these styles inheritBody
style- the filter creates two divs having
custom-style
attribute - after process the image is placed in
custom-style="Graphic Anchor"
div and its caption is incustom-style="Figure Caption"
div respectively
- the filter creates two divs having
- Prepare
Graphic Anchor
andFigure Caption
styles
![Centered image](https://github.com/pandocker/pandoc-docx-utils-py/raw/master/qr.png){width=100mm #fig:centered}
Feature request (via issues) and PRs are welcome. Post questions in issues with [Q]
in issue title.
As lua filters only requires pandoc itself, it is relatively easy
to try develop a new filter. I recommend to use k4zuki/pandocker-alpine
docker image like
docker pull k4zuki/pandocker-alpine
to get image- clone this repo
git clone [email protected]:pandocker/pandocker-lua-filters.git
cd pandocker-lua-filters
docker run --rm -it -v/$PWD:/workdir k4zuki/pandocker-alpine
to start docker imagemake install
to install filters in image. They are installed in/usr/local/share/lua/5.3/pandocker/
make reinstall
to reinstall so that filters will be updatedmake uninstall
to uninstall filtersmake html|pdf|docx
to compile test document- edit
tests/Makefile
to configure options for pandoc
You don't have to reinstall
for every source code updates. Instead edit tests/Makefile
to run your new filter from inside repository.