From d46bd3c2763cb8683e6f0dfd4d725c9e4300a40f Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Wed, 28 Aug 2024 17:23:30 +0300 Subject: [PATCH] chore: Combine Pandoc reader/writer bultins into custom --- docsrc/cli.rst | 4 +++- src/luacheck/builtin_standards/init.lua | 3 +-- src/luacheck/builtin_standards/pandoc.lua | 20 ++++++++------------ 3 files changed, 12 insertions(+), 15 deletions(-) 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..d7b062f3 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", + "ByteStringReader", "ByteStringWriter", "Doc", "Extensions", "Reader", "Template", "Writer", + -- extra types applicable to readers/writers + "Blocksep", "CaptionedImage", "DisplayMath", "DoubleQuoted", "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