Skip to content

Commit

Permalink
chore: Combine Pandoc reader/writer bultins into custom
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Aug 28, 2024
1 parent a9accd6 commit 38c7f63
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
4 changes: 3 additions & 1 deletion docsrc/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ Option Meaning
* ``rockspec`` - globals allowed in rockspecs, by default added for files ending with ``.rockspec``;
* ``luacheckrc`` - globals allowed in Luacheck configs, by default added for files ending with ``.luacheckrc``;
* ``ldoc`` - globals allowed in LDoc config, by default added for files named ``config.ld``;
* ``pandoc`` - globals allowed in Pandoc Lua filters;
* ``pandoc`` - globals allowed in Pandoc Lua;
* ``pandoc_filters`` - globals allowed in Pandoc Lua, subset specific to filters;
* ``pandoc_custom`` - globals allowed in Pandoc Lua, subset specific to custom reader/writers;
* ``sile`` - globals allowed in The SILE Typesetter and its package ecosystem;
* ``none`` - no standard globals.

Expand Down
3 changes: 1 addition & 2 deletions src/luacheck/builtin_standards/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ builtin_standards.sile = {

builtin_standards.pandoc = pandoc.pandoc
builtin_standards.pandoc_filter = pandoc.filter
builtin_standards.pandoc_reader = pandoc.reader
builtin_standards.pandoc_writer = pandoc.writer
builtin_standards.pandoc_custom = pandoc.custom

builtin_standards.none = {}

Expand Down
20 changes: 8 additions & 12 deletions src/luacheck/builtin_standards/pandoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,21 @@ local filter = {
}

-- https://pandoc.org/custom-readers.html
local reader = {
globals = {
"Reader", "Extensions", "ByteStringReader"
},
}

-- https://pandoc.org/custom-writers.html
local writer = {
local custom = {
globals = {
"PANDOC_DOCUMENT", "Writer", "Extensions", "Doc", "Template",
"Blocksep", "ByteStringWriter", "CaptionedImage", "DisplayMath", "DoubleQuoted", "InlineMath", "SingleQuoted",
-- custom scope
"PANDOC_DOCUMENT", "Reader", "Doc", "Template", "Writer", "ByteStringReader", "ByteStringWriter",
-- extra types applicable to readers/writers
"Blocksep", "CaptionedImage", "DisplayMath", "DoubleQuoted", "Extensions", "Extensions", "InlineMath",
"SingleQuoted",
},
}

local variants = {
pandoc = { globals = combine(common, filter, reader, writer) },
pandoc = { globals = combine(common, filter, custom) },
filter = { globals = combine(common, filter) },
reader = { globals = combine(common, reader) },
writer = { globals = combine(common, writer) },
custom = { globals = combine(common, custom) },
}

return variants

0 comments on commit 38c7f63

Please sign in to comment.