Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua module: add readers submodule #3550

Merged
merged 1 commit into from
Apr 3, 2017
Merged

Conversation

tarleb
Copy link
Collaborator

@tarleb tarleb commented Apr 2, 2017

Plain text readers are exposed to lua scripts via the pandoc.reader
submodule, which is further subdivided by format. Converting e.g. a
markdown string into a pandoc document is possible from within lua:

doc = pandoc.reader.markdown.read_doc("Hello, World!")

A read_block convenience function is provided for all formats,
although it will still parse the whole string but return only the first
block as the result.

Custom reader options are not supported yet, default options are used
for all parsing operations.

Plain text readers are exposed to lua scripts via the `pandoc.reader`
submodule, which is further subdivided by format.  Converting e.g. a
markdown string into a pandoc document is possible from within lua:

    doc = pandoc.reader.markdown.read_doc("Hello, World!")

A `read_block` convenience function is provided for all formats,
although it will still parse the whole string but return only the first
block as the result.

Custom reader options are not supported yet, default options are used
for all parsing operations.
@jgm
Copy link
Owner

jgm commented Apr 2, 2017

Can you say a bit about the intended use of this? An example that motivated this addition?

@tarleb
Copy link
Collaborator Author

tarleb commented Apr 2, 2017

I had two use-cases in mind: reading and handling additional metadata (#1960, #3115) and creation of custom include mechanisms for formats that normally don't support it.

Long term, it could become possible to write conversion scripts, allowing for fully portable programs without much trouble. Something like nmap's NSE would be nice.

@jgm jgm merged commit e62fbc1 into jgm:master Apr 3, 2017
@tarleb tarleb deleted the lua-readers-submodule branch April 3, 2017 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants