351 Commits
Author SHA1 Message Date
Albert Krewinkel 9eee4a2582 Lua: add field chunk_template to WriterOptions objects [API change]
The PathTemplate type exported from Text.Pandoc.Chunks is now an
instance of the ToJSON and FromJSON classes.

Closes: #8607
2023-02-09 08:15:13 +01:00
Martin Joerg d9a7d473d9 Fix typos 2023-02-07 10:44:16 +01:00
Albert Krewinkel 5f31a01d77 doc/lua-filters.md: document 'Figure' type and constructor 2023-01-28 18:12:26 +01:00
Carlos Scheidegger b1e4a9eecf Fix typo
`#types-chunkeddoc` -> `#type-chunkeddoc`
2023-01-23 20:32:36 +01:00
James Scott-Brown 456bd09877 fix formatting of link in pandoc-server.md 2023-01-20 00:10:25 +01:00
Albert Krewinkel 3a0fc17880 Lua: add function pandoc.format.extensions.
This simplifies the creation of custom readers and writers that are
based on built-in formats.
2023-01-18 08:59:53 -08:00
Ilona Silverwood 671cfcd869 doc/custom-reader.md: rewrite BytestringReader paragraph 2023-01-18 17:24:00 +01:00
John MacFarlane 70e6f51b96 Add FAQ on producing pdf/a.
See #3215.
2023-01-17 19:29:30 -08:00
Albert Krewinkel 5d58f060ac Lua: Add function pandoc.mediabag.write.
Allows to write the complete mediabag or just a specific file to a given
directory.
2023-01-16 10:12:09 -08:00
Albert Krewinkel cdf8c69fb9 Lua: add module pandoc.structure.
Adds support for table of contents and chunks handling. The function
`make_sections` has been given a friendlier interface and was moved to
the new module; the old `pandoc.utils.make_sections` has been
deprecated.
2023-01-15 10:47:54 -08:00
Albert Krewinkel 8f394a17f2 Remove Null constructor from docs 2023-01-14 10:10:26 +01:00
John MacFarlane d7960212c0 Replace --epub-chapter-level with --split-level.
Rationale: we need this splitting level now not just in
EPUB but in chunked HTML.

`--epub-chapter-level` will still function as a deprecated
synonynm. `epub-chapter-level` will also continue to work in
defaults files, ande `epub_chapter_level` will still work for
Lua marshalling.

[API changes]

Text.Pandoc.App.Opt: remove `optEpubChapterLevel`, add
`optSplitLevel`.

Text.Pandoc.Options: remove `writerEpubChapterLevel`, add
`writerSplitLevel`.
2023-01-12 09:04:29 -08:00
John MacFarlane 61518584b4 Updated some references to master -> main. 2023-01-11 09:18:15 -08:00
R. N. West 660392bd95 Add missing backtick in filters.md 2023-01-10 22:35:33 +01:00
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