|
| 1 | +local add_std_table = require "luacheck.standards".add_std_table |
| 2 | + |
| 3 | +local function combine(...) |
| 4 | + local res = {} |
| 5 | + for _, def in ipairs({...}) do |
| 6 | + add_std_table(res, def) |
| 7 | + end |
| 8 | + return res.fields |
| 9 | +end |
| 10 | + |
| 11 | +local common = { |
| 12 | + read_globals = { |
| 13 | + "pandoc", "lpeg", "re", |
| 14 | + }, |
| 15 | +} |
| 16 | + |
| 17 | +-- https://pandoc.org/lua-filters.html |
| 18 | +local filter = { |
| 19 | + read_globals = { |
| 20 | + "FORMAT", "PANDOC_READER_OPTIONS", "PANDOC_WRITER_OPTIONS", "PANDOC_VERSION", "PANDOC_API_VERSION", |
| 21 | + "PANDOC_SCRIPT_FILE", "PANDOC_STATE", |
| 22 | + }, |
| 23 | + globals = { |
| 24 | + -- document types |
| 25 | + "Inlines", "Inline", "Blocks", "Block", "Meta", "Pandoc", |
| 26 | + -- inline types |
| 27 | + "Cite", "Code", "Emph", "Image", "LineBreak", "Link", "Math", "Note", "Quoted", "RawInline", "SmallCaps", |
| 28 | + "SoftBreak", "Space", "Span", "Str", "Strikeout", "Strong", "Subscript", "Superscript", "Underline", |
| 29 | + -- block types |
| 30 | + "BlockQuote", "BulletList", "CodeBlock", "DefinitionList", "Div", "Figure", "Header", "HorizontalRule", |
| 31 | + "LineBlock", "OrderedList", "Para", "Plain", "RawBlock", "Table", |
| 32 | + }, |
| 33 | +} |
| 34 | + |
| 35 | +-- https://pandoc.org/custom-readers.html |
| 36 | +local reader = { |
| 37 | + globals = { |
| 38 | + "Reader", "Extensions", "ByteStringReader" |
| 39 | + }, |
| 40 | +} |
| 41 | + |
| 42 | +-- https://pandoc.org/custom-writers.html |
| 43 | +local writer = { |
| 44 | + globals = { |
| 45 | + "PANDOC_DOCUMENT", "Writer", "Extensions", "Doc", "Template", |
| 46 | + "Blocksep", "ByteStringWriter", "CaptionedImage", "DisplayMath", "DoubleQuoted", "InlineMath", "SingleQuoted", |
| 47 | + }, |
| 48 | +} |
| 49 | + |
| 50 | +local variants = { |
| 51 | + pandoc = { globals = combine(common, filter, reader, writer) }, |
| 52 | + filter = { globals = combine(common, filter) }, |
| 53 | + reader = { globals = combine(common, reader) }, |
| 54 | + writer = { globals = combine(common, writer) }, |
| 55 | +} |
| 56 | + |
| 57 | +return variants |
0 commit comments