# 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}/pandocker` where
`<sys.prefix>` can be confirmed by `python -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 to `package.path` which can be confirmed
by `lua -e "print(package.path)"`.
## General use
#### Convert AAFigure ascii art
- requires `aafigure` python package
[**`aafigure.lua`**](lua/aafigure.lua)
#### Convert CSV into table
- requires `csv` and `penlight` luarocks packages
- Pandoc below 2.10 applies "simple" filters
[**`csv2table.lua`**](lua/csv2table.lua)<br>
[**`csv2table-simple.lua`**](lua/csv2table-simple.lua)
#### Replace `title` `subtitle` `date` `author` metadata
[**`hide-frontpage-metadata`**](lua/hide-frontpage-metadata.lua)
#### Text file listing
- requires `penlight` luarocks package
[**`listingtable.lua`**](lua/listingtable.lua)
#### Concatenate text files
[**`preprocess.lua`**](lua/preprocess.lua)
#### Removable note block
[**`removable-note.lua`**](lua/removable-note.lua)
#### Convert svgbob ascii art
[**`svgbob.lua`**](lua/svgbob.lua)
#### Convert SVG images to other formats
- requires `rsvg-convert` in `$PATH`
[**`svgconvert.lua`**](lua/svgconvert.lua)
#### Applies table attributes to a table
- requires `penlight` luarocks package
- Pandoc below 2.10 applies "simple" filters
[**`table-width.lua`**](lua/table-width.lua)<br>
[**`table-width-simple.lua`**](lua/table-width-simple.lua)
#### Wavedrom / Bit-Field
- requires `wavedrom-cli` in `$PATH` (`npm i -g wavedrom-cli`)
- requires `lyaml` and `lua-cjson2` luarocks packages
[**`wavedrom.lua`**](lua/wavedrom.lua)
## *LaTeX* output only
#### Landscape pages
[**`tex-landscape.lua`**](lua/tex-landscape.lua)
<!--
#### Reset table coloring
[**`tex-rowcolors-reset`**](lua/tex-rowcolors-reset.lua)
-->
#### Applies underline to `.underline` class span
[**`tex-underline.lua`**](lua/tex-underline.lua)
## *Docx* output only
#### Inserts a comment
[**`docx-comment.lua`**](lua/docx-comment.lua)
#### Apply custom (paragraph) styles for each table cell
[**`docx-apply-cell-styles.lua`**](lua/docx-apply-cell-styles.lua)
#### Apply custom (paragraph) styles for image and its caption
[**`docx-image-styles.lua`**](lua/docx-image-styles.lua)
#### Apply custom (character) styles for any span
[**`docx-custom-span-styles.lua`**](lua/docx-custom-span-styles.lua)
#### Apply in-place color for any span
[**`docx-colored-span.lua`**](lua/docx-colored-span.lua)
#### 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**.
[**`docx-extract-bullet-lists.lua`**](lua/docx-extract-bullet-lists.lua)
##### Requirement for template
- Prepare `Bullet List 1` to `Bullet List 3` paragraph styles (by the way this is 1st level list item)
- Otherwise these headers inherit `Body` style (this is 2nd level)
| Level | Unnumbered |
|:-----:|:--------------|
| 1 | Bullet List 1 |
| 2 | Bullet List 2 |
| 3+ | Bullet List 3 |
#### TOC / Pagebreak / Linebreak
[**`docx-pagebreak-toc.lua`**](lua/docx-pagebreak-toc.lua)
- Adds TOC(Table Of Contents), 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
[**`docx-appendixheadings.lua`**](lua/docx-appendixheadings.lua)
- Makes `appendix` class work to _appendix_ headings in DOCX format
- Limited to level-1 to 5 headings
##### Requirement for template
- Prepare `Appendix Heading 1` to `Appendix Heading 5` heading styles
- Otherwise these headers inherit `Body` style
| 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
[**`docx-unnumberedheadings.lua`**](lua/docx-unnumberedheadings.lua)
- Makes `UnnumberHeadings` class work to _unnumber_ headings in DOCX format
- Limited to level-1 to 5 headings
##### Requirement for template
- Prepare `Heading Unnumbered 1` to `Heading Unnumbered 5` heading styles
- Otherwise these headers inherit `Body` style
| 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
[**`docx-image-styles.lua`**](lua/docx-image-styles.lua)
- Processes only paragraph having single image link
- Blank lines required before and after image link
- Requires `Graphic Anchor` and `Figure Caption` paragraph styles in template
otherwise these styles inherit `Body` 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
in `custom-style="Figure Caption"`
div respectively
##### Requirement for template
- Prepare `Graphic Anchor` and `Figure Caption` styles
# samples
```markdown
![Centered image](https://github.com/pandocker/pandoc-docx-utils-py/raw/master/qr.png){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-alpine` to get image
- clone this repo `git clone git@github.com:pandocker/pandocker-lua-filters.git`
- `cd pandocker-lua-filters`
- `docker run --rm -it -v/$PWD:/workdir k4zuki/pandocker-alpine` to start docker image
- `make 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 updated
- `make uninstall` to uninstall filters
- `make 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/pandocker/pandocker-lua-filters",
"name": "pandocker-lua-filters",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Pandoc Lua Filter",
"author": "pandocker",
"author_email": "pandocker@github.com",
"download_url": "",
"platform": null,
"description": "# pandocker-lua-filters\n\nLua filters for pandoc\n\n## Install\n\n- installs as a python package for ease of use\n - `pip install pandocker-lua-filters`\n- Lua filters should be installed under `<sys.prefix>/share/lua/{5.3|5.4}/pandocker` where\n `<sys.prefix>` can be confirmed by `python -c \"import sys; print(sys.prefix)\"`. It install **both** 5.3 and 5.4\n directories no matter of actual lua versions in system.\n This `<sys.prefix>/share/lua/{5.3|5.4}` should be added to `package.path` which can be confirmed\n by `lua -e \"print(package.path)\"`.\n\n## General use\n\n#### Convert AAFigure ascii art\n\n- requires `aafigure` python package\n\n[**`aafigure.lua`**](lua/aafigure.lua)\n\n#### Convert CSV into table\n\n- requires `csv` and `penlight` luarocks packages\n- Pandoc below 2.10 applies \"simple\" filters\n\n[**`csv2table.lua`**](lua/csv2table.lua)<br>\n[**`csv2table-simple.lua`**](lua/csv2table-simple.lua)\n\n#### Replace `title` `subtitle` `date` `author` metadata\n\n[**`hide-frontpage-metadata`**](lua/hide-frontpage-metadata.lua)\n\n#### Text file listing\n\n- requires `penlight` luarocks package\n\n[**`listingtable.lua`**](lua/listingtable.lua)\n\n#### Concatenate text files\n\n[**`preprocess.lua`**](lua/preprocess.lua)\n\n#### Removable note block\n\n[**`removable-note.lua`**](lua/removable-note.lua)\n\n#### Convert svgbob ascii art\n\n[**`svgbob.lua`**](lua/svgbob.lua)\n\n#### Convert SVG images to other formats\n\n- requires `rsvg-convert` in `$PATH`\n\n[**`svgconvert.lua`**](lua/svgconvert.lua)\n\n#### Applies table attributes to a table\n\n- requires `penlight` luarocks package\n- Pandoc below 2.10 applies \"simple\" filters\n\n[**`table-width.lua`**](lua/table-width.lua)<br>\n[**`table-width-simple.lua`**](lua/table-width-simple.lua)\n\n#### Wavedrom / Bit-Field\n\n- requires `wavedrom-cli` in `$PATH` (`npm i -g wavedrom-cli`)\n- requires `lyaml` and `lua-cjson2` luarocks packages\n\n[**`wavedrom.lua`**](lua/wavedrom.lua)\n\n## *LaTeX* output only\n\n#### Landscape pages\n\n[**`tex-landscape.lua`**](lua/tex-landscape.lua)\n\n<!--\n#### Reset table coloring\n\n[**`tex-rowcolors-reset`**](lua/tex-rowcolors-reset.lua)\n-->\n\n#### Applies underline to `.underline` class span\n\n[**`tex-underline.lua`**](lua/tex-underline.lua)\n\n## *Docx* output only\n\n#### Inserts a comment\n\n[**`docx-comment.lua`**](lua/docx-comment.lua)\n\n#### Apply custom (paragraph) styles for each table cell\n\n[**`docx-apply-cell-styles.lua`**](lua/docx-apply-cell-styles.lua)\n\n#### Apply custom (paragraph) styles for image and its caption\n\n[**`docx-image-styles.lua`**](lua/docx-image-styles.lua)\n\n#### Apply custom (character) styles for any span\n\n[**`docx-custom-span-styles.lua`**](lua/docx-custom-span-styles.lua)\n\n#### Apply in-place color for any span\n\n[**`docx-colored-span.lua`**](lua/docx-colored-span.lua)\n\n#### Apply custom (paragraph) styles for any unnumbered bullet lists\n\nFinds unnumbered bullet lists down to 3rd level and applies custom paragraph styles.\n**4th level and lower list items are escalated to 3rd level**.\n\n[**`docx-extract-bullet-lists.lua`**](lua/docx-extract-bullet-lists.lua)\n\n##### Requirement for template\n\n- Prepare `Bullet List 1` to `Bullet List 3` paragraph styles (by the way this is 1st level list item)\n - Otherwise these headers inherit `Body` style (this is 2nd level)\n\n| Level | Unnumbered |\n|:-----:|:--------------|\n| 1 | Bullet List 1 |\n| 2 | Bullet List 2 |\n| 3+ | Bullet List 3 |\n\n#### TOC / Pagebreak / Linebreak\n\n[**`docx-pagebreak-toc.lua`**](lua/docx-pagebreak-toc.lua)\n\n- Adds TOC(Table Of Contents), a line break or a page break at any point of document\n\n##### Requirement for template\n\nTOC title is set to \"Table of Contents\" by default. Metadata `toc-title` overrides this setting.\n\n#### Appendix headings\n\n[**`docx-appendixheadings.lua`**](lua/docx-appendixheadings.lua)\n\n- Makes `appendix` class work to _appendix_ headings in DOCX format\n- Limited to level-1 to 5 headings\n\n##### Requirement for template\n\n- Prepare `Appendix Heading 1` to `Appendix Heading 5` heading styles\n - Otherwise these headers inherit `Body` style\n\n| Level | Numbered | Unnumbered |\n|:-----:|:----------|:-------------------|\n| 1 | Heading 1 | Appendix Heading 1 |\n| 2 | Heading 2 | Appendix Heading 2 |\n| 3 | Heading 3 | Appendix Heading 3 |\n| 4 | Heading 4 | Appendix Heading 4 |\n| 5 | Heading 5 | Appendix Heading 5 |\n| 6 | Heading 6 | |\n\n#### Unnumbered headings\n\n[**`docx-unnumberedheadings.lua`**](lua/docx-unnumberedheadings.lua)\n\n- Makes `UnnumberHeadings` class work to _unnumber_ headings in DOCX format\n- Limited to level-1 to 5 headings\n\n##### Requirement for template\n\n- Prepare `Heading Unnumbered 1` to `Heading Unnumbered 5` heading styles\n - Otherwise these headers inherit `Body` style\n\n| Level | Numbered | Unnumbered |\n|:-----:|:----------|:---------------------|\n| 1 | Heading 1 | Heading Unnumbered 1 |\n| 2 | Heading 2 | Heading Unnumbered 2 |\n| 3 | Heading 3 | Heading Unnumbered 3 |\n| 4 | Heading 4 | Heading Unnumbered 4 |\n| 5 | Heading 5 | Heading Unnumbered 5 |\n| 6 | Heading 6 | |\n\n#### Figure styles\n\n[**`docx-image-styles.lua`**](lua/docx-image-styles.lua)\n\n- Processes only paragraph having single image link\n - Blank lines required before and after image link\n- Requires `Graphic Anchor` and `Figure Caption` paragraph styles in template\n otherwise these styles inherit `Body` style\n - the filter creates two divs having `custom-style` attribute\n - after process the image is placed in `custom-style=\"Graphic Anchor\"` div and its caption is\n in `custom-style=\"Figure Caption\"`\n div respectively\n\n##### Requirement for template\n\n- Prepare `Graphic Anchor` and `Figure Caption` styles\n\n# samples\n\n```markdown\n![Centered image](https://github.com/pandocker/pandoc-docx-utils-py/raw/master/qr.png){width=100mm #fig:centered}\n```\n\n## Want a new feature?\n\nFeature request (via issues) and PRs are welcome. Post questions in issues with `[Q]` in issue title.\n\n### DIY\n\nAs lua filters only requires pandoc itself, it is relatively easy\nto try develop a new filter. I recommend to use `k4zuki/pandocker-alpine`\n*docker image* like\n\n- `docker pull k4zuki/pandocker-alpine` to get image\n- clone this repo `git clone git@github.com:pandocker/pandocker-lua-filters.git`\n- `cd pandocker-lua-filters`\n- `docker run --rm -it -v/$PWD:/workdir k4zuki/pandocker-alpine` to start docker image\n- `make install` to install filters in image. They are installed in `/usr/local/share/lua/5.3/pandocker/`\n- `make reinstall` to *reinstall* so that filters will be updated\n- `make uninstall` to uninstall filters\n- `make html|pdf|docx` to compile test document\n- edit `tests/Makefile` to configure options for pandoc\n\nYou don't have to `reinstall` for every source code updates. Instead edit `tests/Makefile`\nto run your new filter from inside repository.\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Lua filter collection for pandoc",
"version": "0.0.30",
"project_urls": {
"Bug Reports": "https://github.com/pandocker/pandocker-lua-filters/issues",
"Homepage": "https://github.com/pandocker/pandocker-lua-filters",
"Source": "https://github.com/pandocker/pandocker-lua-filters/"
},
"split_keywords": [
"pandoc",
"lua",
"filter"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b29175f5ec01d14c5fe5d8ef486e60f31e3115c0843b807fb8e42b55fb5d3b2e",
"md5": "d5781ba6043b83233f58da9f0347a406",
"sha256": "c12786e1e44ed2af841f3d757976fde0e0bd9474b36be15e6ef3238ba9d36af0"
},
"downloads": -1,
"filename": "pandocker_lua_filters-0.0.30-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d5781ba6043b83233f58da9f0347a406",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5293587,
"upload_time": "2023-12-18T07:35:09",
"upload_time_iso_8601": "2023-12-18T07:35:09.907348Z",
"url": "https://files.pythonhosted.org/packages/b2/91/75f5ec01d14c5fe5d8ef486e60f31e3115c0843b807fb8e42b55fb5d3b2e/pandocker_lua_filters-0.0.30-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-18 07:35:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pandocker",
"github_project": "pandocker-lua-filters",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pandocker-lua-filters"
}