aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2018-01-10 22:26:12 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2018-01-13 00:07:03 +0100
commit8d5422f36b28bab67b4d13e4a3d2154d0c5024f8 (patch)
tree0e2770c50622cc91ddaa9a0c1bc825fb9d62a180 /doc
parent5d49cbd35e815dd041e54da511bdd0eeafd400c0 (diff)
downloadpandoc-8d5422f36b28bab67b4d13e4a3d2154d0c5024f8.tar.gz
Lua modules: add function pandoc.utils.run_json_filter
Runs a JSON filter on a Pandoc document.
Diffstat (limited to 'doc')
-rw-r--r--doc/lua-filters.md31
1 files changed, 31 insertions, 0 deletions
diff --git a/doc/lua-filters.md b/doc/lua-filters.md
index 9b82155be..6f03360bb 100644
--- a/doc/lua-filters.md
+++ b/doc/lua-filters.md
@@ -1433,6 +1433,37 @@ functions.
print(table.concat(elements[1].numbering, '.')) -- 0.1
print(table.concat(elements[2].numbering, '.')) -- 0.2
+[`run_json_filter (doc, filter[, args])`]{#utils-run_json_filter}
+
+: Filter the given doc by passing it through the a JSON filter.
+
+ Parameters:
+
+ `doc`:
+ : the Pandoc document to filter
+
+ `filter`:
+ : filter to run
+
+ `args`:
+ : list of arguments passed to the filter. Defaults to
+ `{FORMAT}`.
+
+ Returns:
+
+ - ([Pandoc](#Pandoc)) Filtered document
+
+ Usage:
+
+ -- Assumes `some_blocks` contains blocks for which a
+ -- separate literature section is required.
+ local sub_doc = pandoc.Pandoc(some_blocks, metadata)
+ sub_doc_with_bib = pandoc.utils.run_json_filter(
+ sub_doc,
+ 'pandoc-citeproc'
+ )
+ some_blocks = sub_doc.blocks -- some blocks with bib
+
[`normalize_date (date_string)`]{#utils-normalize_date}
: Parse a date and convert (if possible) to "YYYY-MM-DD"