summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
Diffstat (limited to 'data')
-rw-r--r--data/pandoc.lua47
1 files changed, 0 insertions, 47 deletions
diff --git a/data/pandoc.lua b/data/pandoc.lua
index 3be3b507a..df8aa06c4 100644
--- a/data/pandoc.lua
+++ b/data/pandoc.lua
@@ -874,53 +874,6 @@ M.UpperAlpha = "UpperAlpha"
-- Helper Functions
-- @section helpers
---- Parse the given string into a Pandoc document.
--- The method used to interpret input is specified by *format*. Acceptable
--- values for this parameter are equal to those that can be given to the
--- `--from` command line option.
--- @tparam string markup the markup to be parsed
--- @tparam[opt] string format format specification, defaults to "markdown".
--- @treturn Pandoc pandoc document
--- @usage
--- local org_markup = "/emphasis/" -- Input to be read
--- local document = pandoc.read(org_markup, "org")
--- -- Get the first block of the document
--- local block = document.blocks[1]
--- -- The inline element in that block is an `Emph`
--- assert(block.content[1].t == "Emph")
-function M.read(markup, format)
- format = format or "markdown"
- local pd = pandoc._read(format, markup)
- if type(pd) == "string" then
- error(pd)
- else
- return pd
- end
-end
-
---- Runs command with arguments, passing it some input, and returns the output.
--- @treturn string Output of command.
--- @raise A table containing the keys `command`, `error_code`, and `output` is
--- thrown if the command exits with a non-zero error code.
--- @usage
--- local ec, output = pandoc.pipe("sed", {"-e","s/a/b/"}, "abc")
-function M.pipe (command, args, input)
- local ec, output = pandoc._pipe(command, args, input)
- if ec ~= 0 then
- err = setmetatable(
- { command = command, error_code = ec, output = output},
- { __tostring = function(e)
- return "Error running " .. e.command
- .. " (error code " .. e.error_code .. "): "
- .. e.output
- end
- }
- )
- error(err)
- end
- return output
-end
-
--- Use functions defined in the global namespace to create a pandoc filter.
-- All globally defined functions which have names of pandoc elements are
-- collected into a new table.