data/pandoc.lua: re-export all bundled modules

All Lua modules bundled with pandoc, i.e., `pandoc.List`,
`pandoc.mediabag`, `pandoc.utils`, and `text` are re-exported from the
`pandoc` module. They are assigned to the fields `List`, `mediabag`,
`utils`, and `text`, respectively.
This commit is contained in:
Albert Krewinkel 2019-02-09 09:52:51 +01:00
parent 4543543063
commit 9a9c138d9c
No known key found for this signature in database
GPG key ID: 388DC0B21F631124
3 changed files with 20 additions and 11 deletions

View file

@ -3,5 +3,3 @@
-- default modules.
pandoc = require 'pandoc'
pandoc.mediabag = require 'pandoc.mediabag'
pandoc.utils = require 'pandoc.utils'

View file

@ -1,7 +1,7 @@
--[[
pandoc.lua
Copyright © 20172018 Albert Krewinkel
Copyright © 20172019 Albert Krewinkel
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
@ -20,16 +20,20 @@ THIS SOFTWARE.
-- Lua functions for pandoc scripts.
--
-- @author Albert Krewinkel
-- @copyright © 20172018 Albert Krewinkel
-- @copyright © 20172019 Albert Krewinkel
-- @license MIT
local M = {}
-- Other modules used here; those are also re-exported.
local List = require 'pandoc.List'
local utils = require 'pandoc.utils'
-- Re-export bundled modules
M.List = require 'pandoc.List'
M.mediabag = require 'pandoc.mediabag'
M.utils = require 'pandoc.utils'
M.text = require 'text'
-- Local names for modules which this module depends on.
local List = M.List
local utils = M.utils
M.List = List
M.utils = utils
------------------------------------------------------------------------
-- Accessor objects

View file

@ -1360,8 +1360,8 @@ to a string via `tostring`.
# Module text
UTF-8 aware text manipulation functions, implemented in Haskell.
These are available to any lua filter. However, the module must
be explicitly loaded:
The module is made available as part of the `pandoc` module via
`pandoc.text`. The text module can also be loaded explicitly:
``` {.lua}
-- uppercase all regular text in a document:
@ -2392,6 +2392,13 @@ The `pandoc.mediabag` module allows accessing pandoc's media
storage. The "media bag" is used when pandoc is called with the
`--extract-media` or `--standalone`/`-s` option.
The module is loaded as part of module `pandoc` and can either be
accessed via the `pandoc.mediabag` field, or explicitly required,
e.g.:
local mb = require 'pandoc.mediabag'
### insert {#mediabag-insert}
`insert (filepath, mime_type, contents)`