aboutsummaryrefslogtreecommitdiff
path: root/test/lua/module/pandoc-utils.lua
AgeCommit message (Collapse)AuthorFilesLines
2021-12-21Lua: simplify code of pandoc.utils.stringifyAlbert Krewinkel1-4/+3
Minor behavior change: plain strings nested in tables are now included in the result string.
2021-12-21Lua tests: add more tests for `pandoc.utils.stringify`.Albert Krewinkel1-2/+45
2021-12-21Lua: add tests for pandoc.utils.equalsAlbert Krewinkel1-0/+40
2021-12-21Lua: add new library function `pandoc.utils.type`.Albert Krewinkel1-0/+40
The function behaves like the default `type` function from Lua's standard library, but is aware of pandoc userdata types. A typical use-case would be to determine the type of a metadata value.
2021-12-20Lua: use more natural representation for Reference valuesAlbert Krewinkel1-0/+25
Omit `false` boolean values, push integers as numbers.
2021-12-19Lua: fixup, should have been part of previous commitAlbert Krewinkel1-3/+3
2021-11-29Lua: remove `pandoc.utils.text` (#7720)Albert Krewinkel1-28/+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-23Lua: add function `pandoc.utils.text` (#7710)Albert Krewinkel1-0/+28
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
2020-09-20Lua filters: add SimpleTable for backwards compatibility (#6575)Albert Krewinkel1-0/+66
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.
2019-09-08Replace Element and makeHierarchical with makeSections.John MacFarlane1-8/+5
Text.Pandoc.Shared: + Remove `Element` type [API change] + Remove `makeHierarchicalize` [API change] + Add `makeSections` [API change] + Export `deLink` [API change] Now that we have Divs, we can use them to represent the structure of sections, and we don't need a special Element type. `makeSections` reorganizes a block list, adding Divs with class `section` around sections, and adding numbering if needed. This change also fixes some longstanding issues recognizing section structure when the document contains Divs. Closes #3057, see also #997. All writers have been changed to use `makeSections`. Note that in the process we have reverted the change c1d058aeb1c6a331a2cc22786ffaab17f7118ccd made in response to #5168, which I'm not completely sure was a good idea. Lua modules have also been adjusted accordingly. Existing lua filters that use `hierarchicalize` will need to be rewritten to use `make_sections`.
2019-05-29Lua: add Version type to simplify comparisonsAlbert Krewinkel1-0/+96
Version specifiers like `PANDOC_VERSION` and `PANDOC_API_VERSION` are turned into `Version` objects. The objects simplify version-appropriate comparisons while maintaining backward-compatibility. A function `pandoc.types.Version` is added as part of the newly introduced module `pandoc.types`, allowing users to create version objects in scripts.