Commit Graph
330 Commits
Author SHA1 Message Date
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
Elliot Bobrow 6ff4972ca9 add --embed-resources flag (#8121)
* Add `--embed-resources` flag for `--self-contained` without implying
  `--standalone`
* Deprecate `--self-contained flag`

Closes #7331
2022-06-14 17:00:18 -06:00
Bastien Dumont 7244821705 Make clear that walk performs a deep copy (#8124)
Relevant discussion here: https://groups.google.com/g/pandoc-discuss/c/-NoL3Ft9AC8

I felt that it could be useful to inform that walk is the only way to get a deep copy of a List. I wrote this where I think that users will likely loop up for this feature, but it may be out of place.
2022-06-14 16:14:19 -06:00
John MacFarlane 39fdf08fcc Add press.md (formerly press.txt in website). 2022-06-06 10:07:29 -07:00
Albert Krewinkel b2b21bb4c5 Lua: add function pandoc.mediabag.fill (#8104)
The function allows to fill the mediabag with all images in a given
document. Images that cannot be fetched are replaced with a Span
containing the image description.
2022-06-06 09:25:09 -07:00
Albert Krewinkel dbc80c1a6b JATS template: allow multiple licenses to be given.
The `license` metadata field can now be used to set the license of an
article; a list can be used to add multiple license statements.
2022-04-04 10:05:32 +02:00
Albert Krewinkel c694a6e4f5 JATS template: allow multiple copyright statements, years, holders 2022-04-02 15:29:37 +02:00
Albert Krewinkel ad726953b9 Lua: allow to pass Sources to pandoc.read (#8002)
Sources, the data type passed to the `Reader` function in custom
readers, are now accepted as input to `pandoc.read`.
2022-03-30 14:10:30 -07:00