Lua filter collection for pandoc
Project description
pandocker-lua-filters
Lua filters for pandoc
Install
- 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}/pandockerwhere<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.pathwhich can be confirmed bylua -e "print(package.path)".
General use
Convert AAFigure ascii art
- requires
aafigurepython package
Convert CSV into table
- requires
csvandpenlightluarocks packages - Pandoc below 2.10 applies "simple" filters
csv2table.lua
csv2table-simple.lua
Replace title subtitle date author metadata
Text file listing
- requires
penlightluarocks package
Concatenate text files
Removable note block
Convert svgbob ascii art
Convert SVG images to other formats
- requires
rsvg-convertin$PATH
Applies table attributes to a table
- requires
penlightluarocks package - Pandoc below 2.10 applies "simple" filters
table-width.lua
table-width-simple.lua
Wavedrom / Bit-Field
- requires
wavedrom-cliin$PATH(npm i -g wavedrom-cli) - requires
lyamlandlua-cjson2luarocks packages
LaTeX output only
Landscape pages
Applies underline to .underline class span
Docx output only
Inserts a comment
Apply custom (paragraph) styles for each table cell
Apply custom (paragraph) styles for image and its caption
Apply custom (character) styles for any span
Apply in-place color for any span
Apply custom (paragraph) styles for any unnumbered bullet lists
Finds unnumbered bullet lists down to 3rd level and applies custom paragraph styles. 4th level and lower list items are escalated to 3rd level.
Requirement for template
- Prepare
Bullet List 1toBullet List 3paragraph styles (by the way this is 1st level list item)- Otherwise these headers inherit
Bodystyle (this is 2nd level)
- Otherwise these headers inherit
| Level | Unnumbered |
|---|---|
| 1 | Bullet List 1 |
| 2 | Bullet List 2 |
| 3+ | Bullet List 3 |
TOC / Pagebreak / Linebreak / Sub section TOC
- Adds TOC(Table Of Contents), sub sections, a line break or a page break at any point of document
Requirement for template
TOC title is set to "Table of Contents" by default. Metadata toc-title overrides this setting.
Appendix headings
- Makes
appendixclass work to appendix headings in DOCX format - Limited to level-1 to 5 headings
Requirement for template
- Prepare
Appendix Heading 1toAppendix Heading 5heading styles- Otherwise these headers inherit
Bodystyle
- 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 |
Unnumbered headings
- Makes
UnnumberHeadingsclass work to unnumber headings in DOCX format - Limited to level-1 to 5 headings
Requirement for template
- Prepare
Heading Unnumbered 1toHeading Unnumbered 5heading styles- Otherwise these headers inherit
Bodystyle
- 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 |
Figure styles
- Processes only paragraph having single image link
- Blank lines required before and after image link
- Requires
Graphic AnchorandFigure Captionparagraph styles in template otherwise these styles inheritBodystyle- the filter creates two divs having
custom-styleattribute - 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
Requirement for template
- Prepare
Graphic AnchorandFigure Captionstyles
samples
{width=100mm #fig:centered}
Want a new feature?
Feature request (via issues) and PRs are welcome. Post questions in issues with [Q] in issue title.
DIY
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-alpineto get image- clone this repo
git clone git@github.com:pandocker/pandocker-lua-filters.git cd pandocker-lua-filtersdocker run --rm -it -v/$PWD:/workdir k4zuki/pandocker-alpineto start docker imagemake installto install filters in image. They are installed in/usr/local/share/lua/5.3/pandocker/make reinstallto reinstall so that filters will be updatedmake uninstallto uninstall filtersmake html|pdf|docxto compile test document- edit
tests/Makefileto 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pandocker_lua_filters-0.0.33-py3-none-any.whl.
File metadata
- Download URL: pandocker_lua_filters-0.0.33-py3-none-any.whl
- Upload date:
- Size: 3.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef529c65c17d51f2f29339a45bfbb687394800cd2fd7be89bdf799731ea18add
|
|
| MD5 |
1ae41d8aeda5509ba221d1854400c6eb
|
|
| BLAKE2b-256 |
00731ec0a07f1606aca4e8a1fefa3eadf6fed3791cb146a4dd8bb74f9639e16e
|