432 Commits
Author SHA1 Message Date
Albert Krewinkel 992842d07b Lua: accept filename-contents pairs as env for pandoc.read
Key-value pairs, mapping from filename to contents, can be used to fill
the ersatz file system used in the reader sandbox.
2025-05-14 09:17:24 -07:00
Albert Krewinkel 5b896bc1a9 Lua: allow to pass files to the pandoc.read sandbox
The sandbox is now enabled if the fourth parameter is a list of files.
The files are read and then made available in the sandbox via a mock
file system.
2025-05-14 09:17:24 -07:00
Albert Krewinkel 31f74fac06 Lua: support sandboxed parsing with pandoc.read.
The function `pandoc.read` is now taking an optional fourth parameter
that specifies the environment in which the parser will be run. Passing
the string `sandbox` as the argument causes the reader to run in a
sandbox, thereby preventing all access to the network and file system.

Closes: #10831
2025-05-13 23:38:36 +02:00
Niklas Eicker 82ff661b1a Mention in the docs, that typst:no-figure is a class, not an attribute (#10826) 2025-05-07 14:56:29 -07:00
R. N. West 7930fd143d doc/lua-filters.md: Add missing html_math_method 'katex' 2025-02-24 16:45:13 +01:00
Charles Tapley HoytandJez Cope 1eed55f391 Add CRediT roles to JATS
Enable annotating author roles using the Contribution Role Taxonomy
(CRediT) and export this information in conformant JATS

Closes #10152.

Co-Authored-By: Jez Cope <457628+jezcope@users.noreply.github.com>
2025-02-05 21:28:56 -08:00
Albert Krewinkel 6c31896c29 doc/lua-filters: add note about extensions handling in read and write 2025-02-04 10:46:47 +01:00
R. N. West (Nat) 77fca2d61a doc/lua-filters.md: Correct luacheck URL (#10589) 2025-01-31 08:56:47 -08:00
R. N. West 31e36d4fd5 doc/extras.md: Add entry for pandoc-subfigs
https://github.com/rnwst/pandoc-subfigs
2025-01-30 16:51:17 +01:00
R. N. West d8af7b05c7 doc/extras.md: Update diagram Lua filter URL (and description) 2025-01-30 16:51:17 +01:00
R. N. West (Nat) f17de990b4 doc/lua-filters.md: Add static analysis paragraph to debugging section (#10568) 2025-01-29 13:22:04 -08:00
John MacFarlane 4814067f5a lua-filters.md: document system.os return values.
Closes #10523.
2025-01-11 10:25:46 -08:00
Albert Krewinkel 8c96c6e776 doc/lua-filters.md: Fix links to constructors.
This was broken when the respective sections started to be
autogenerated.
2024-12-10 11:06:37 +01:00
Andreas Deininger eeb8b1eb3a Fix typos (#10349) 2024-11-06 10:04:33 -08:00
Albert Krewinkel daef2fd53e doc/libraries.md: Sort list alphabetically 2024-10-23 11:08:00 +02:00
Albert Krewinkel aeb0f2a19b doc/libraries.md: Add newly developed Haskell packages 2024-10-23 11:00:02 +02:00
Albert Krewinkel 734227a59d doc/lua-filters.md: document pandoc.List:iter method
List objects have a new function `iter` that returns an iterator
function that returns the next list item on each call.
2024-10-14 07:15:34 +02:00
Albert Krewinkel a37035caa1 doc/lua-filters.md: list functions in pandoc.utils alphabetically 2024-10-01 12:24:13 +02:00
Albert Krewinkel 4cf6ddb027 Lua: allow returning a single filter from filter files
It is now possible to return a single filter from a filter file, e.g.

``` lua
-- Switch single- and double quotes
return {
  Quoted = function (q)
    elem.quotetype = elem.quotetype == 'SingleQuote'
      and 'DoubleQuote' or 'SingleQuote'
    return elem
  end
}

The filter must not contain numerical indexes, or it might be treated as
a list of filters.
2024-10-01 12:23:36 +02:00
Akash PatelandJohn MacFarlane ca348940e3 Add support for list of figures (lof) and list of tables (lot) (#10029)
Two new command-line options are added:

`--lof[=true|false]`, `--list-of-figures[=true|false]`
`--lot[=true|false]`, `--list-of-tables[=true|false]`

Only docx, latex, and context are supported at this point.

Setting the `lof` and `lot` variables will also work for the formats that are
currently supported.

[API changes]

+ Lua: `list_of_figures` and `list_of_tables` can now be used in writer options.
+ Text.Pandoc.Options:  add `writerListOfFigures` and `writerListOfTables` fields
  to `WriterOptions`.
+ Text.Pandoc.App.Opt: add `optListOfFigures` and `optListOfTables` to `Opt`.

Closes #8245.

Co-authored-by: John MacFarlane <jgm@berkeley.edu>
2024-09-22 11:49:52 -07:00
Albert Krewinkel 8aa796f30a Lua: support character styling via pandoc.layout
The `Doc` values produced and handled by the `pandoc.layout` module can
now be styled using `bold`, `italic`, `underlined`, or `strikeout`. The
style is ignored in normal rendering, but becomes visible when rendering
to ANSI output. The `pandoc.layout.render` function now takes a third
parameter that defines the output style, either *plain* or *ansi*.
2024-09-21 15:20:34 +02:00
Albert Krewinkel 05aa18420f Lua: update List module
The module now comes with a method `:at(index[, def])` that allows to access
indices, accepts negative indices to count from the end, and will return the
`def` value as a default if the list has no item at the given position.

Furthermore, the list constructor `pandoc.List` now accepts iterators. E.g.,
`pandoc.List(text:gmatch '%S+')` returns the list of words in `text`.

Closes: #9835
2024-09-21 10:10:35 +02:00
Albert Krewinkel 5ccf380dad JATS template: support floats-group
The content of the `floats-group` variable is now rendered in a
`<floats-group>` element when using the *publishing* or *archiving* tag
sets.

Discussion: #10196
2024-09-20 17:36:36 +02:00
John MacFarlane 7bc4f60789 Update FAQ for converting a directory of files in Windows.
Use fullname rather than name (#5429 comment).
2024-07-28 09:13:56 -07:00
Albert Krewinkel 790abcf414 lua-filters.md: Partially autogenerate docs for module "pandoc"
The documentation system isn't powerful enough to generate the full
documentation automatically.
2024-07-08 16:30:45 +02:00
Albert Krewinkel 1e8799ca60 doc/custom-writers.md: document the separator arg of Writer.Blocks
Mention that the default `Writer.Blocks` function in
`pandoc.scaffolding.Writer` takes a separator as an optional second
argument.
2024-06-18 09:13:05 +02:00
Albert Krewinkel e6f298f19f doc/lua-filters.md: Fix outdated docs
Documentation of math and quoting related functions and fields was
updated. The docs had been outdated since at least pandoc 2.17.
2024-06-11 16:45:24 +02:00
Albert Krewinkel 7b85353780 doc/lua-filters.md: correct return type of pandoc.layout.render. 2024-06-10 07:28:00 +02:00
Albert Krewinkel d416619298 doc/lua-filters.md: Document operators of the "Doc" type. 2024-06-10 07:10:15 +02:00
Albert Krewinkel da4a55a985 lua-filters: auto-generate docs for pandoc.layout module. 2024-06-09 22:19:57 +02:00
Albert KrewinkelandCarsten Gips 9af5b1ca8b Lua: add function pandoc.template.get.
The function allows to specify a template with the same argument value
that would be used with the `--template` command line parameter.

Closes: #9854

Co-authored-by: Carsten Gips <cagix@hsbi.de>
2024-06-08 08:42:47 -07:00
Albert Krewinkel 7db19d8cd4 Update more copyright dates to 2024. 2024-06-08 16:46:42 +02:00
Albert Krewinkel bfb0475d67 doc/lua-filters: autogenerate docs for module pandoc.template 2024-06-07 20:36:29 +02:00
Albert Krewinkel 430d525378 Lua: allow passing an environment to run_lua_filter.
The default is now to use a *copy* of the global environment when running a
filter; this ensures better separation when `run_lua_filter` is used multiple
times. A custom environment can be specified via the optional third parameter.
2024-06-07 08:36:24 +02:00
Carlos Scheidegger 347985fb83 typst,table - support '.typst:no-figure' and 'typst:figure:kind=kind' (#9778)
This extends support for fine-grained properties in Typst.

If the `typst:no-figure` class is present on a Table, the table will not be placed in a figure.

If the `typst:figure:kind` attribute is present, its value will be used for the figure's `kind`.

These features are documented in `doc/typst-property-output.md`.

Closes #9777.
2024-06-03 09:52:53 -07:00
John MacFarlane b9491ccbbc Support supplementary-material in metadata for jats_articlepublishing.
See #9818.
2024-06-03 09:37:35 -07:00
Albert Krewinkel 04dba0d771 Lua: fix typo in run_lua_filter
Fixes previous commit ad68ff34ae.
2024-05-28 13:46:18 +02:00
Albert Krewinkel ad68ff34ae Lua: add function pandoc.utils.run_lua_filter (#9803) 2024-05-27 14:20:31 -07:00
Albert Krewinkel f3ed3b3614 doc/custom-writers.md: fix usage of Template in example 2024-05-24 19:51:46 +02:00
Albert Krewinkel e5c135e68e Lua: add a pandoc.log module. 2024-05-10 19:03:29 -07:00
Albert Krewinkel 0f29d8195e Lua: use hslua-module-zip-1.1.3 to fix the windows build 2024-05-05 21:16:31 +02:00
Albert Krewinkel 018922d10f Lua: use newest zip module.
This adds a `symlink` function to Entry objects, allowing to check if an
entry represents a symbolic link.
2024-05-05 17:54:33 +02:00
Albert Krewinkel 32f0ed9ea3 Lua: improve pandoc.json.decode docs. 2024-05-05 00:25:29 +02:00
Albert Krewinkel 1a15c9f6a9 tools/update-lua-module-docs.lua: cleanup, fix code 2024-05-04 23:56:01 +02:00
Albert Krewinkel c45f163b4d Lua: fix generated docs.
Update and fix docs for `pandoc.types.Version` and `pandoc.utils.type`.
2024-05-04 22:17:01 +02:00
Albert Krewinkel 5f937eae61 Lua: add new module pandoc.image
The module provides basic querying functions for image properties.
2024-04-16 10:23:08 -07:00
Gordon Woodhull 99a45917ac Typst writer: property output (#9648)
The Typst writer will pass on specially marked attributes as raw Typst
parameters on selected elements. This allows extensive customization
using filters.

An attribute with key `typst:PROP` will set the PROP parameter on
the corresponding Typst element.

An attribute with key `typst:text:PROP` will set a parameter on a Typst
`#set text()` rule or a text element.

The feature has been implemented for the following elements:

* span text
* div and div text
* table and table text
* table cell and table cell text

It would be possible to support more elements in the future.

A separate document has been added that provides extensive
documentation and examples of the use of this feature.
2024-04-15 09:32:32 -07:00
Chandrahas77 5e507024b9 fixed typo in doc/org.md (#9634) 2024-04-04 23:13:00 -07:00
Carlos Scheidegger e4ac26d255 Update lua-filters.md (#9611)
Fix formatting of `pandoc.utils.type` usage entry
2024-03-27 12:22:10 -06:00
standstaff ad1e979c92 Typos: remove repeated words (#9577)
Signed-off-by: standstaff <zhengxingru@yeah.net>
2024-03-15 10:38:16 -07:00