Commit Graph
337 Commits
Author SHA1 Message Date
Albert Krewinkel 8862d5e0dd Lua: add functions pandoc.text.toencoding, pandoc.text.fromencoding.
Closes: #8512
2023-01-03 10:35:22 +01:00
Albert Krewinkel 1328e57f08 Shared: use LineBreak as default block sep in blocksToInlines
This change also affects the `pandoc.utils.blocks_to_inlines` Lua
function.

Closes: #8499
2022-12-20 13:39:16 -08:00
Albert Krewinkel a36f12119f Lua: allow table structure as format spec.
This allows to pass structured values as format specifiers to
`pandoc.write` and `pandoc.read`.
2022-12-16 10:43:01 -08:00
Albert Krewinkel 928dde57b9 Lua: add pandoc.cli module
Allow processing of CLI options in Lua.
2022-12-12 09:35:21 -08:00
TomBen 18874be79d Fix a tiny typo in lua-filters.md 2022-12-07 21:28:36 -08:00
Albert Krewinkel e0e6087145 Shared: change defaultBlocksSeparator to PARAGRAPH SEPARATOR
This Unicode char (U+2029) is intended as a semantic separator between
paragraphs; it is cleaner and less intrusive than the pilcrow sign that
we used before. This also changes the default `sep` value used in the
`pandoc.utils.blocks_to_inlines` Lua function.
2022-12-08 00:24:07 +01:00
Albert Krewinkel b34ec00607 doc/lua-filters.md: add documentation for pandoc.format 2022-12-03 16:22:19 +01:00
Vladimir Alexiev 202eacb686 Update epub.md
minor typo s/above/about/
2022-11-16 10:42:05 -08:00
John MacFarlane 6e1cfa2af5 Lua: rename reader_extensions/writer_extensions globals...
...as `Extensions`.

Update documnetation.

Include a custom extension in the documentation example.

See #8390.
2022-10-25 10:17:23 -07:00
Albert Krewinkel 79d6b45566 Remove sample.lua from data files (#8397)
The file is kept around in the pandoc-lua-engine test-suite.

Closes: #8356
2022-10-24 09:46:42 -07:00
Albert Krewinkel e243cd696f Lua: add pandoc.scaffolding.Writer (#8377)
This can be used to reduce boilerplate in custom writers.
2022-10-21 10:11:45 -07:00
Albert Krewinkel f711c7f2aa Lua: add new module pandoc.zip
Allows to handle docx and epub files.
2022-10-20 09:11:57 -07:00
Albert Krewinkel 8900b0f953 Lua: Support built-in default templates for custom writers
Custom writers can define a default template via a global `Template`
function; the data directory is no longer searched for a default
template.

Writer authors can restore the old lookup behavior with

``` lua
Template = function ()
  local template
  return template.compile(template.default(PANDOC_SCRIPT_FILE))
end
```
2022-10-14 10:37:37 -07:00
Albert Krewinkel 06ba4e9788 doc/custom-writers.md: fix formatting 2022-10-14 17:14:49 +02:00
Ilona d501199aea doc/custom-writers.md: Rephrase paragraph on format extensions (#8375) 2022-10-14 17:13:24 +02:00
Albert Krewinkel 14c7b5db20 Lua: add function pandoc.template.meta_to_context.
The functions converts Meta values to template contexts; the intended
use is in combination with `pandoc.template.apply`.
2022-10-12 10:16:01 -07:00
Albert Krewinkel 253d2e768a Lua: support extensions in custom readers.
Like custom readers, like writers, can define the set of supported
extensions by setting a global. E.g.:

``` lua
reader_extensions = {
  smart = true,
  citations = false,
}
```
2022-10-12 11:58:18 +02:00
Albert Krewinkel 78d7fc46fe Lua: add function pandoc.template.apply
The new function applies a context, containing variable assignments, to
a template.
2022-10-11 14:03:08 -07:00
Albert Krewinkel a088cbf563 Lua: support extensions in custom writers
Custom writers can define the extensions that they support via the
global `writer_extensions`. The variable's value must be a table with
all supported extensions as keys, and their default status as values.

E.g., the below specifies that the writer support the extensions `smart`
and `sourcepos`, but only the `smart` extension is enabled by default:

    writer_extensions = {
      smart = true,
      sourcepos = false,
    }
2022-10-10 09:39:18 -07:00
Albert Krewinkel 44827c1161 doc/libraries.md: add hslua-cli and the hslua-module-* packages 2022-10-10 16:59:20 +02:00
Albert Krewinkel 8f4308f2e5 doc/lua-filters.md: deprecate PANDOC_WRITER_OPTIONS in custom writers 2022-10-10 12:09:09 +02:00
Albert Krewinkel a5ffaaa413 Lua: support custom bytestring readers. 2022-10-10 11:27:42 +02:00
Albert Krewinkel 654059efed doc/lua-filters.md: fix typos 2022-10-09 11:48:03 +02:00
Ian Max Andolina 2d27a06312 Update Lua filter doc: modify Zerobrane instructions to use Lua 5.4 (#8353) 2022-10-08 18:27:50 -07:00
Albert Krewinkel 2d565eda9e doc/lua-filters.md: fix documentation of PANDOC_WRITER_OPTIONS. 2022-10-03 20:01:55 +02:00
Albert Krewinkel 59e9df4262 doc/lua-filters.md: document pandoc.write_classic. 2022-10-03 19:57:02 +02:00
Albert Krewinkel 3324664aab [API Change] Support bytestring custom writers.
New-style custom Lua writers can now define an alternative entry function
`BinaryWriter`. If a function with that name is defined, then pandoc
will treat the returned string as binary output. This allows to generate
formats like docx and odt with custom writers.
2022-10-03 08:47:32 -07:00
Albert Krewinkel 921d7dd271 Lua: deprecate classic custom writers. 2022-10-03 08:47:32 -07:00
Albert Krewinkel 309163f5bc [API Change] Base custom writers on Writer type.
The `T.P.Lua.writeCustom` function changed to allow either a TextWriter
or ByteStringWriter to be returned. The global variables
`PANDOC_DOCUMENT` and `PANDOC_WRITER_OPTIONS` are no longer set when the
writer script is loaded. Both variables are still set in classic writers
before the conversion is started, so they can be used when they are
wrapped in functions.
2022-10-03 08:47:32 -07:00
Albert Krewinkel de0e3ff5f6 pandoc-lua: support more command line flags 2022-09-26 19:50:39 +02:00
Artem Pelenitsyn b3e8a28414 doc: use cabal's --package-env more (#8317) 2022-09-25 17:13:36 -07:00
Albert Krewinkel 22fa51ded1 Make pandoc behave like a Lua interpreter when called as pandoc-lua. (#8311) 2022-09-22 14:39:25 -07:00
John MacFarlane b682249ada PandocServer: return error in JSON object if response is JSON. 2022-08-29 09:52:32 -07:00
John MacFarlane 6a7ab9bb4e pandoc-server.md: fix documentation for highlight-style. 2022-08-26 16:36:51 -07:00
Albert Krewinkel 04d873ace3 docs/faqs.md: fix typo in faq on pdf generation 2022-08-23 22:10:04 +02:00
luz paz aff726b460 Fix typos
Found via `codespell -q 3 -S changelog.md -L bu,fo,ist,mke,multline,noes,ot,pard,pres,tabl,te,tothe`
2022-08-21 20:23:00 -07:00
John MacFarlane d3aa51b1ee pandoc-server.cgi: allow setting timeout
via PANDOC_SERVER_TIMEOUT environment variable.
2022-08-18 22:33:19 -07:00
John MacFarlane 6534caf7cb pandoc-server.md: fix typo 2022-08-17 16:34:43 -07:00
John MacFarlane 8ddc2fc79a Integrate server into main pandoc.
- Remove server flag.
- Remove pandoc-server executable.
- Add Text.Pandoc.Server as exposed module. [API change]
- Re-use Opt (and our existing FromJSON instance) for Params.
- Document.
2022-08-17 12:28:14 -07:00
Albert Krewinkel 5a99747063 Lua: add function pandoc.utils.citeproc
The function runs the *citeproc* processor on a Pandoc document.
Exposing this functionality to Lua allows to make citation processing
part of a filter or writer, simplifies the creation of multiple
bibliographies, and enables the use of varying citation styles in
different parts of a document.
2022-08-13 12:30:13 -07:00
Albert Krewinkel 4633fc3ca0 doc/libraries.md: add hslua packages written specifically for pandoc 2022-08-02 11:09:51 +02:00
John MacFarlane bec41531fc Add gridtables to doc/libraries.md. 2022-07-30 09:56:51 -07:00
John MacFarlane 4ba72aaa2e Fix bug in filter example. Thanks to Jiří Wolker. 2022-07-27 08:40:31 -07:00
Albert Krewinkel daef24f022 Lua: extend pandoc.system module. (#8184)
The module now has the additional functions `list_directory`,
`make_directory`, and `remove_directory`. This makes it easier to write
cross-platform scripts that need to inspect or modify the file system.
2022-07-15 21:22:33 +02:00
John MacFarlane 7119fee963 lua-filters.md: Add link to @wlupton's logging.lua.
Closes #8146.
2022-07-15 21:18:21 +02:00
Albert Krewinkel 12cc140272 Lua: add fields pandoc.readers and pandoc.writers. (#8177)
The set of supported input and output formats is made available to Lua
users.
2022-07-12 20:14:42 +02:00
John MacFarlane f2f9c896ee Add FAQ on preventing column widths in pipe tables.
See #8139.
2022-07-04 13:35:12 +02:00
Masataka Ogawa 6c31cae68b Update filter.md Noto Sans CJK TC -> JP (#8153)
Noto Sans CJK TC, that is suggested as a character set that contains Japanese characters, may not be suitable to properly display Japanese characters. Rather, Noto Sans CJK JP is much more recommendable for that purpose.

Although some characters originated from China are quite similar among countries/regions, most of them have evolved into different shapes in Mainland China, Hong Kong, Taiwan, Japan, Korea, and Vietnam. Therefore, it is best to use a character set that the language of the country/region uses for the readability/recongnizability sake. See also [an webpage that discusses the glyph appearance issue in Chinese, Japanese, Korean, and Vietnamese languages](https://heistak.github.io/your-code-displays-japanese-wrong/).

[README of Noto CJK](https://github.com/googlefonts/noto-cjk/blob/main/README.md) may be also good resource to know which font should be used to display characters of each language.
2022-06-30 14:48:45 +02:00
Albert Krewinkel 41af476a3d JATS template: mark authors with cor-id as corresponding authors
Corresponding authors are marked by setting the attribute
`corresp="yes"` in their respective `<contrib>` element.
2022-06-24 15:44:38 +02:00
Albert Krewinkel 37fc412daa doc/lua-filters.html: add list of common pitfalls
A list with common filtering and Lua pitfalls is added to the
"debugging" section.

Closes: #6077
2022-06-16 17:40:33 +02:00