Skip to content

Commit

Permalink
fixup! nfy
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Aug 27, 2024
1 parent a7dde7d commit f72419c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/luacheck/builtin_standards/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,10 @@ builtin_standards.sile = {
}
}

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.pandoc = pandoc.pandoc
builtin_standards.pandoc_filter = pandoc.filter
builtin_standards.pandoc_reader = pandoc.reader
builtin_standards.pandoc_writer = pandoc.writer

builtin_standards.none = {}

Expand Down
23 changes: 15 additions & 8 deletions src/luacheck/builtin_standards/pandoc.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
local add_std_table = require "luacheck.standards".add_std_table

local function combine (...)
local res = {}
for _, input in ipairs({...}) do
add_std_table(res, input)
end
return res
end

local common = {
globals = {
-- Global modules
read_globals = {
"pandoc", "lpeg", "re",
},
}

-- https://pandoc.org/lua-filters.html
local filter = {
read_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
},
globals = {
-- - top level
Expand Down Expand Up @@ -40,8 +47,8 @@ local writer = {
}

return {
common = common,
filter = filter,
reader = reader,
writer = writer,
pandoc = combine(common, filter, reader, writer),
filter = combine(common, filter),
reader = combine(common, reader),
writer = combine(common, writer),
}

0 comments on commit f72419c

Please sign in to comment.