aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-10-25 10:16:34 -0700
committerJohn MacFarlane <[email protected]>2022-10-25 10:17:23 -0700
commit6e1cfa2af546029385eb8bf8049c08e7b8e16fe2 (patch)
tree1065b9f3699106d60e192aa57d50669276988708
parent119de20e60ecf40ce00f7d7206f7f87c7ad4c3c1 (diff)
Lua: rename `reader_extensions`/`writer_extensions` globals...
...as `Extensions`. Update documnetation. Include a custom extension in the documentation example. See #8390.
-rw-r--r--doc/custom-readers.md11
-rw-r--r--doc/custom-writers.md9
-rw-r--r--pandoc-lua-engine/src/Text/Pandoc/Lua/Reader.hs2
-rw-r--r--pandoc-lua-engine/src/Text/Pandoc/Lua/Writer.hs2
-rw-r--r--pandoc-lua-engine/test/extensions.lua2
5 files changed, 14 insertions, 12 deletions
diff --git a/doc/custom-readers.md b/doc/custom-readers.md
index 4d2009690..2d9938121 100644
--- a/doc/custom-readers.md
+++ b/doc/custom-readers.md
@@ -98,19 +98,20 @@ end
Custom readers can be built such that their behavior is
controllable through format extensions, such as `smart`,
`citations`, or `hard-line-breaks`. Supported extensions are those
-that are present as a key in the global `reader_extensions` table.
+that are present as a key in the global `Extensions` table.
Fields of extensions that are enabled default have the value
`true`, while those that are supported but disabled have value
`false`.
Example: A writer with the following global table supports the
-extensions `smart` and `citations`, with the former enabled and
-the latter disabled by default:
+extensions `smart`, `citations`, and `foobar`, with `smart` enabled and
+the other two disabled by default:
``` lua
-reader_extensions = {
+Extensions = {
smart = true,
citations = false,
+ foobar = false
}
```
@@ -129,7 +130,7 @@ end
```
Extensions that are neither enabled nor disabled in the
-`reader_extensions` field are treated as unsupported by the
+`Extensions` field are treated as unsupported by the
reader. Trying to modify such an extension via the command line
will lead to an error.
diff --git a/doc/custom-writers.md b/doc/custom-writers.md
index 1d90ea722..55c64eb8a 100644
--- a/doc/custom-writers.md
+++ b/doc/custom-writers.md
@@ -53,19 +53,20 @@ then only the `Writer` function will be used.
Writers can be customized through format extensions, such as
`smart`, `citations`, or `hard_line_breaks`. The global
-`writer_extensions` table indicates supported extensions with a
+`Extensions` table indicates supported extensions with a
key. Extensions enabled by default are assigned a true value,
while those that are supported but disabled are assigned a false
value.
Example: A writer with the following global table supports the
-extensions `smart` and `citations`, with the former enabled and
-the latter disabled by default:
+extensions `smart`, `citations`, and `foobar`, with `smart` enabled and
+the others disabled by default:
``` lua
-writer_extensions = {
+Extensions = {
smart = true,
citations = false,
+ foobar = false
}
```
diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Reader.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Reader.hs
index 2c2dd369b..8e411aeb2 100644
--- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Reader.hs
+++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Reader.hs
@@ -48,7 +48,7 @@ readCustom luaFile = do
when (stat /= Lua.OK)
Lua.throwErrorAsException
- extsConf <- getglobal "reader_extensions" >>= \case
+ extsConf <- getglobal "Extensions" >>= \case
TypeNil -> pure $ ExtensionsConfig mempty mempty
_ -> forcePeek $ peekExtensionsConfig top `lastly` pop 1
diff --git a/pandoc-lua-engine/src/Text/Pandoc/Lua/Writer.hs b/pandoc-lua-engine/src/Text/Pandoc/Lua/Writer.hs
index eeec9b6af..e310b33c8 100644
--- a/pandoc-lua-engine/src/Text/Pandoc/Lua/Writer.hs
+++ b/pandoc-lua-engine/src/Text/Pandoc/Lua/Writer.hs
@@ -61,7 +61,7 @@ writeCustom luaFile = do
let writerField = "Pandoc Writer function"
- extsConf <- rawgetglobal "writer_extensions" >>= \case
+ extsConf <- rawgetglobal "Extensions" >>= \case
TypeNil -> ExtensionsConfig mempty mempty <$ pop 1
_ -> forcePeek $ peekExtensionsConfig top `lastly` pop 1
diff --git a/pandoc-lua-engine/test/extensions.lua b/pandoc-lua-engine/test/extensions.lua
index cea9a45a1..d286f5c41 100644
--- a/pandoc-lua-engine/test/extensions.lua
+++ b/pandoc-lua-engine/test/extensions.lua
@@ -6,7 +6,7 @@ function Writer (doc, opts)
return output:format(status('smart'), status('citations'))
end
-writer_extensions = {
+Extensions = {
smart = true,
citations = false,
}