diff --git a/docsrc/cli.rst b/docsrc/cli.rst index 628ee290..f8e6685a 100644 --- a/docsrc/cli.rst +++ b/docsrc/cli.rst @@ -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. diff --git a/src/luacheck/builtin_standards/init.lua b/src/luacheck/builtin_standards/init.lua index 159f766f..377d88d4 100644 --- a/src/luacheck/builtin_standards/init.lua +++ b/src/luacheck/builtin_standards/init.lua @@ -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 = {} diff --git a/src/luacheck/builtin_standards/pandoc.lua b/src/luacheck/builtin_standards/pandoc.lua index e03cffaa..ef37bd6b 100644 --- a/src/luacheck/builtin_standards/pandoc.lua +++ b/src/luacheck/builtin_standards/pandoc.lua @@ -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