aboutsummaryrefslogtreecommitdiff
path: root/doc/lua-filters.md
AgeCommit message (Collapse)AuthorFilesLines
2021-12-13doc/lua-filters.md: update description of walk methods, fix typosAlbert Krewinkel1-18/+23
2021-12-13Lua: support topdown traversalsAlbert Krewinkel1-2/+47
The traversal order of filters can now be selected by setting the key `traverse` of the filter to either `'topdown'` or `'typewise'`; the default remains `'typewise'`. Topdown traversals can be cut short by returning `false` as a second value from the filter function. No child-element of the returned element is processed in that case.
2021-12-10Switch to released pandoc-lua-marshal-0.1.2Albert Krewinkel1-0/+9
Cell values are now marshaled as userdata objects; a constructor function for table cells is provided as `pandoc.Cell`.
2021-12-09Lua: update to latest pandoc-lua-marshal (0.1.1)Albert Krewinkel1-5/+176
- `walk` methods are added to `Block` and `Inline` values; the methods are similar to `pandoc.utils.walk_block` and `pandoc.utils.walk_inline`, but apply to filter also to the element itself, and therefore return a list of element instead of a single element. - Functions of name `Doc` are no longer accepted as alternatives for `Pandoc` filter functions. This functionality was undocumented.
2021-11-29Lua: remove `pandoc.utils.text` (#7720)Albert Krewinkel1-18/+0
The new `pandoc.Inlines` function behaves identical on string input, but allows other Inlines-like arguments as well. The `pandoc.utils.text` function could be written as function pandoc.utils.text (x) assert(type(x) == 'string') return pandoc.Inlines(x) end
2021-11-28doc/lua-filters.md: update docs on Blocks, Inlines, MetaValueAlbert Krewinkel1-75/+79
2021-11-28Lua: add constructors `pandoc.Blocks` and `pandoc.Inlines`Albert Krewinkel1-1/+36
The functions convert their argument into a list of Block and Inline values, respectively.
2021-11-23Lua: add function `pandoc.utils.text` (#7710)Albert Krewinkel1-0/+18
The function converts a string to `Inlines`, treating interword spaces as `Space`s or `SoftBreak`s. If you want a `Str` with literal spaces, use `pandoc.Str`. Closes: #7709
2021-11-17Lua: set `lpeg`, `re` as globals; allow shared lib access via requireAlbert Krewinkel1-8/+17
The `lpeg` and `re` modules are loaded into globals of the respective name, but they are not necessarily registered as loaded packages. This ensures that - the built-in library versions are preferred when setting the globals, - a shared library is used if pandoc has been compiled without `lpeg`, and - the `require` mechanism can be used to load the shared library if available, falling back to the internal version if possible and necessary.
2021-11-11Lua: load `re` module available into global of the same nameAlbert Krewinkel1-7/+20
2021-11-06Lua: allow to pass custom reader options to `pandoc.read`Albert Krewinkel1-4/+38
Reader options can now be passed as an optional third argument to `pandoc.read`. The object can either be a table or a ReaderOptions value like `PANDOC_READER_OPTIONS`. Creating new ReaderOptions objects is possible through the new constructor `pandoc.ReaderOptions`. Closes: #7656
2021-11-05doc/lua-filters.md: add section on global modules, including lpegAlbert Krewinkel1-0/+10
2021-09-04Rephrase pandoc.path docs (#7548)Quinn1-2/+2
2021-09-04Improve order of Image fieldsQuinn1-3/+3
Ensure consistency throughout docs
2021-09-04Add missing type for Image titleQuinn1-1/+1
2021-08-30Do not leak working directory in TikZ filterJeroen de Haas1-3/+3
2021-03-28Fixed typo #7159TatianaPorras1-1/+1
This commit fixes the typo in the Lua filters documentation, see #7159
2021-03-28Fixed "The this" typo in lua-filters.mdTatianaPorras1-1/+1
The documentation for Lua filters said "The this module defines..." This has been fixed to say "This module defines..."
2021-02-26Fix/update URLs and use HTTP**S** where possible (#7122)Salim B1-1/+1
2021-02-04doc/lua-filters.md: improve docs for `pandoc.mediabag.insert`Albert Krewinkel1-2/+3
2021-02-04doc/lua-filters.md: fix, improve docs for `pandoc.mediabag.fetch`Albert Krewinkel1-2/+12
2021-02-02Improve docs for directory, normalizeAlbert Krewinkel1-3/+6
2021-02-02Lua: add module "pandoc.path"Albert Krewinkel1-0/+172
The module allows to work with file paths in a convenient and platform-independent manner. Closes: #6001 Closes: #6565
2020-12-14typoIan Sullivan1-1/+1
2020-11-01Fix code example in lua-filters.md.John MacFarlane1-1/+2
Closes #6795, thanks to Odin Kroeger.
2020-10-12doc/lua-filters.md: fix typosAlbert Krewinkel1-20/+24
Use American spelling.
2020-10-11doc/lua-filters.md: describe parameters to `pandoc.pipe`Albert Krewinkel1-1/+13
2020-10-08Add info on how to debug Lua filters (#6732)Ian Max Andolina1-0/+19
Add info on debugging Lua filters.
2020-10-04doc/lua-filters.md: document Underline type and constructorAlbert Krewinkel1-0/+27
2020-09-20Lua filters: add SimpleTable for backwards compatibility (#6575)Albert Krewinkel1-0/+115
A new type `SimpleTable` is made available to Lua filters. It is similar to the `Table` type in pandoc versions before 2.10; conversion functions from and to the new Table type are provided. Old filters using tables now require minimal changes and can use, e.g., if PANDOC_VERSION > {2,10,1} then pandoc.Table = pandoc.SimpleTable end and function Table (tbl) tbl = pandoc.utils.to_simple_table(tbl) … return pandoc.utils.from_simple_table(tbl) end to work with the current pandoc version.
2020-08-26Make the setting-the-date example conditionalthe-solipsist1-3/+5
This makes the example a bit more realistic/valuable by checking if the metadata value "date" is already present, before changing the value.
2020-08-07doc/lua-filters.md: add missing Link.title fieldAlbert Krewinkel1-0/+3
2020-07-29doc/lua-filters.md: add missing header attributeAlbert Krewinkel1-1/+1
2020-07-28Lua filter docs: remove link table exampleAlbert Krewinkel1-36/+0
The example is outdated and requires a complete overhaul.
2020-07-25doc/lua-filters.md: document `body` fieldAlbert Krewinkel1-3/+6
2020-07-25Lua filters: make attr argument optional in Table constructorAlbert Krewinkel1-6/+15
This changes the Lua API. It is highly unlikely for this change to affect existing filters, since the documentation for the new Table constructor (and type) was incomplete and partly wrong before. The Lua API is now more consistent, as all constructors for elements with attributes now take attributes as the last parameter.
2020-07-25doc/lua-filters.md: fix documentation for tablesAlbert Krewinkel1-20/+123
2020-07-09Fix Typos in Lua Filters Doctajmone1-4/+4
2020-05-25lua-filters.md: use pandoc.system module in TikZ exampleAlbert Krewinkel1-39/+48
Showcase temporary directory handling with `with_temporary_directory` and `with_working_directory`.
2020-04-01Fix description of BulletList Lua typeLevi Gruspe1-5/+5
Change description of BulletList parameter from 'List of Blocks' to 'List of List of Blocks'.
2020-01-18doc/lua-filters.md: fix copy-paste mistakeAlbert Krewinkel1-1/+1
Closes: #6040
2020-01-15Lua filters: allow filtering of element lists (#6040)Albert Krewinkel1-1/+71
Lists of Inline and Block elements can now be filtered via `Inlines` and `Blocks` functions, respectively. This is helpful if a filter conversion depends on the order of elements rather than a single element. For example, the following filter can be used to remove all spaces before a citation: function isSpaceBeforeCite (spc, cite) return spc and spc.t == 'Space' and cite and cite.t == 'Cite' end function Inlines (inlines) for i = #inlines-1,1,-1 do if isSpaceBeforeCite(inlines[i], inlines[i+1]) then inlines:remove(i) end end return inlines end Closes: #6038
2020-01-12docs: capitalize Lua where it refers to the programming language nameAlbert Krewinkel1-15/+15
This follows the advise on the Lua website (https://www.lua.org/about.html#name): > […] "Lua" is a name, the name of the Earth's moon and the name of the > language. Like most names, it should be written in lower case with an > initial capital, that is, "Lua".
2020-01-11Lua filter docs: cross-link constructors and typesAlbert Krewinkel1-62/+281
Thanks to @bpj for the idea.
2020-01-11Lua: add methods `insert`, `remove`, and `sort` to pandoc.ListAlbert Krewinkel1-0/+59
The functions `table.insert`, `table.remove`, and `table.sort` are added to pandoc.List elements. They can be used as methods, e.g. local numbers = pandoc.List {2, 3, 1} numbers:sort() -- numbers is now {1, 2, 3}
2020-01-11doc/lua-filters.md: sort pandoc.List methods alphabeticallyAlbert Krewinkel1-34/+34
2020-01-11doc/lua-filters.md: unify, fix anchors and internal links (#6061)Albert Krewinkel1-362/+334
Links and anchors now follow consistent conventions, like lowercase-only anchor names. This breaks some links to specific sections in the document, but will make it much easier to link documentation in the future.
2020-01-11pandoc.List.lua: make `pandoc.List` a callable constructorAlbert Krewinkel1-1/+23
It is now possible to construct a new List via `pandoc.List()` instead of `pandoc.List:new()`.
2020-01-10docs/lua-filters.md: clarify filter function execution order (#6059)Albert Krewinkel1-2/+30
2019-12-22doc/lua-filters.md: replace metadata example with image centering (#6004)Albert Krewinkel1-22/+23
Metadata defaults can be given via the command line `--metadata-file`. Adding raw format snippets is a common use case for Lua filters, so it seems sensible to provide an example. Thanks to @efx for proposing this filter. Closes: pandoc/lua-filters#70