diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2017-04-30 11:24:48 +0200 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2017-04-30 11:24:48 +0200 |
commit | 01e8df2e53cfd31d9c4c88f9854281392ccaf6ed (patch) | |
tree | 401c04c7a0e8c233877e97217785afff1319e7a9 /data | |
parent | 31caa616a9353e073eb86be7889b7087e14a48ac (diff) | |
download | pandoc-01e8df2e53cfd31d9c4c88f9854281392ccaf6ed.tar.gz |
Lua module: add example for usage of `read`
Diffstat (limited to 'data')
-rw-r--r-- | data/pandoc.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/data/pandoc.lua b/data/pandoc.lua index 46155a575..bb79724aa 100644 --- a/data/pandoc.lua +++ b/data/pandoc.lua @@ -797,9 +797,19 @@ M.UpperAlpha = "UpperAlpha" -- @section helpers --- Parse the given string into a Pandoc document. --- @tparam string markup the markup to be parsed +-- 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". -- @return Doc 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) |