diff --git a/doc/lua-filters.md b/doc/lua-filters.md index b4ac31479..b1c9bacbf 100644 --- a/doc/lua-filters.md +++ b/doc/lua-filters.md @@ -3589,6 +3589,28 @@ Usage: -- pandoc.Emph{ pandoc.Str 'Paragraph2' } -- } +### `citeproc (doc)` {#pandoc.utils.citeproc} + +Process the citations in the file, replacing them with rendered +citations and adding a bibliography. See the manual section on +citation rendering for details. + +Parameters: + +`doc` +: document ([Pandoc](#type-pandoc)) + +Returns: + +- processed document ([Pandoc](#type-pandoc)) + +Usage: + + -- Lua filter that behaves like `--citeproc` + function Pandoc (doc) + return pandoc.utils.citeproc(doc) + end + ### `equals (element1, element2)` {#pandoc.utils.equals} Test equality of AST elements. Elements in Lua are considered diff --git a/src/Text/Pandoc/Lua/Module/Utils.hs b/src/Text/Pandoc/Lua/Module/Utils.hs index 14796b146..6c373ae2f 100644 --- a/src/Text/Pandoc/Lua/Module/Utils.hs +++ b/src/Text/Pandoc/Lua/Module/Utils.hs @@ -25,7 +25,7 @@ import Data.Maybe (fromMaybe) import Data.Version (Version) import HsLua as Lua import HsLua.Module.Version (peekVersionFuzzy, pushVersion) -import Text.Pandoc.Citeproc (getReferences) +import Text.Pandoc.Citeproc (getReferences, processCitations) import Text.Pandoc.Definition import Text.Pandoc.Error (PandocError) import Text.Pandoc.Lua.Marshal.AST @@ -59,6 +59,16 @@ documentedModule = Module <#> opt (parameter (peekList peekInline) "list of inlines" "inline" "") =#> functionResult pushInlines "list of inlines" "" + , defun "citeproc" + ### unPandocLua . processCitations + <#> parameter peekPandoc "Pandoc" "doc" "document" + =#> functionResult pushPandoc "Pandoc" "processed document" + #? T.unwords + [ "Process the citations in the file, replacing them with " + , "rendered citations and adding a bibliography. " + , "See the manual section on citation rendering for details." + ] + , defun "equals" ### equal <#> parameter pure "AST element" "elem1" ""