aboutsummaryrefslogtreecommitdiff
path: root/doc/lua-filters.md
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-01-15 11:43:46 -0700
committerGitHub <noreply@github.com>2018-01-15 11:43:46 -0700
commitf114153481b81320e73e55cc5524680cd8f5ebfc (patch)
tree45f158b1cf3e836952cd91001f09836b52af9c33 /doc/lua-filters.md
parentb010113f3f63f5ca936942ba48a4ea823470ba8b (diff)
parent8d5422f36b28bab67b4d13e4a3d2154d0c5024f8 (diff)
downloadpandoc-f114153481b81320e73e55cc5524680cd8f5ebfc.tar.gz
Merge pull request #4227 from tarleb/lua-run-json-filter
Run JSON filters from Lua filters
Diffstat (limited to 'doc/lua-filters.md')
-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"