diff --git a/luacheck-dev-1.rockspec b/luacheck-dev-1.rockspec index 0389dd14..6506e1a1 100644 --- a/luacheck-dev-1.rockspec +++ b/luacheck-dev-1.rockspec @@ -46,6 +46,7 @@ build = { ["luacheck.builtin_standards"] = "src/luacheck/builtin_standards/init.lua", ["luacheck.builtin_standards.love"] = "src/luacheck/builtin_standards/love.lua", ["luacheck.builtin_standards.minetest"] = "src/luacheck/builtin_standards/minetest.lua", + ["luacheck.builtin_standards.pandoc"] = "src/luacheck/builtin_standards/pandoc.lua", ["luacheck.builtin_standards.playdate"] = "src/luacheck/builtin_standards/playdate.lua", ["luacheck.builtin_standards.ngx"] = "src/luacheck/builtin_standards/ngx.lua", ["luacheck.cache"] = "src/luacheck/cache.lua", diff --git a/src/luacheck/builtin_standards/init.lua b/src/luacheck/builtin_standards/init.lua index d0068f9e..9f4f9c13 100644 --- a/src/luacheck/builtin_standards/init.lua +++ b/src/luacheck/builtin_standards/init.lua @@ -1,5 +1,6 @@ local love = require "luacheck.builtin_standards.love" local minetest = require "luacheck.builtin_standards.minetest" +local pandoc = require "luacheck.builtin_standards.pandoc" local playdate = require "luacheck.builtin_standards.playdate" local ngx = require "luacheck.builtin_standards.ngx" local standards = require "luacheck.standards" @@ -344,25 +345,10 @@ builtin_standards.sile = { } } --- https://pandoc.org/lua-filters.html#global-variables -builtin_standards.pandoc = { - globals = { - -- Global modules - "pandoc", "lpeg", "re", - -- Global variables passed to filters - "FORMAT", "PANDOC_READER_OPTIONS", "PANDOC_WRITER_OPTIONS", "PANDOC_VERSION", "PANDOC_API_VERSION", - "PANDOC_SCRIPT_FILE", "PANDOC_STATE", - -- Globals that can be used to create filter elements - -- - top level - "Inlines", "Inline", "Blocks", "Block", "Meta", "Pandoc", - -- - inline - "Cite", "Code", "Emph", "Image", "LineBreak", "Link", "Math", "Note", "Quoted", "RawInline", "SmallCaps", - "SoftBreak", "Space", "Span", "Str", "Strikeout", "Strong", "Subscript", "Superscript", "Underline", - -- - block - "BlockQuote", "BulletList", "CodeBlock", "DefinitionList", "Div", "Figure", "Header", "HorizontalRule", - "LineBlock", "OrderedList", "Para", "Plain", "RawBlock", "Table", - } -} +builtin_standards.pandoc = add_defs(pandoc.common, pandoc.filter, pandoc.reader, pandoc.writer) +builtin_standards.pandoc_filter = add_defs(pandoc.common, pandoc.filter) +builtin_standards.pandoc_reader = add_defs(pandoc.common, pandoc.reader) +builtin_standards.pandoc_writer = add_defs(pandoc.common, pandoc.writer) builtin_standards.none = {} diff --git a/src/luacheck/builtin_standards/pandoc.lua b/src/luacheck/builtin_standards/pandoc.lua new file mode 100644 index 00000000..f73417cc --- /dev/null +++ b/src/luacheck/builtin_standards/pandoc.lua @@ -0,0 +1,43 @@ +local common = { + globals = { + -- Global modules + "pandoc", "lpeg", "re", + } +} + +-- https://pandoc.org/lua-filters.html#global-variables +local filter = { + globals = { + -- Global variables passed to filters + "FORMAT", "PANDOC_READER_OPTIONS", "PANDOC_WRITER_OPTIONS", "PANDOC_VERSION", "PANDOC_API_VERSION", + "PANDOC_SCRIPT_FILE", "PANDOC_STATE", + -- Globals that can be used to create filter elements + -- - top level + "Inlines", "Inline", "Blocks", "Block", "Meta", "Pandoc", + -- - inline + "Cite", "Code", "Emph", "Image", "LineBreak", "Link", "Math", "Note", "Quoted", "RawInline", "SmallCaps", + "SoftBreak", "Space", "Span", "Str", "Strikeout", "Strong", "Subscript", "Superscript", "Underline", + -- - block + "BlockQuote", "BulletList", "CodeBlock", "DefinitionList", "Div", "Figure", "Header", "HorizontalRule", + "LineBlock", "OrderedList", "Para", "Plain", "RawBlock", "Table", + } +} + +local reader = { + globals = { + "Reader", "Extensions", "ByteStringReader" + } +} + +local writer = { + globals = { + "PANDOC_DOCUMENT", "Writer", "Extensions", "Doc" + } +} + +return { + common = common, + filter = filter, + reader = reader, + writer = writer, +}