Skip to content

Commit eb662fa

Browse files
committed
Fix bugs in Lua scripts surfaced by Luacheck
1 parent 961f700 commit eb662fa

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

data/creole.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ local function ListItem(lev, ch)
5252
end
5353

5454
-- Grammar
55-
G = P{ "Doc",
55+
local grammar = P{ "Doc",
5656
Doc = Ct(V"Block"^0)
5757
/ pandoc.Pandoc ;
5858
Block = blankline^0
@@ -185,6 +185,6 @@ G = P{ "Doc",
185185
/ pandoc.Strong ;
186186
}
187187

188-
function Reader(input, reader_options)
189-
return lpeg.match(G, tostring(input))
188+
function Reader(input, _)
189+
return lpeg.match(grammar, tostring(input))
190190
end

pandoc-lua-engine/test/lua/module/pandoc-list.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,18 @@ return {
116116

117117
group 'new' {
118118
test('make table usable as list', function ()
119-
local test = List:new{1, 1, 2, 3, 5}
119+
local out = List:new{1, 1, 2, 3, 5}
120120
assert.are_same(
121121
{1, 1, 4, 9, 25},
122-
test:map(function (x) return x^2 end)
122+
out:map(function (x) return x^2 end)
123123
)
124124
end),
125125
test('return empty list if no argument is given', function ()
126126
assert.are_same({}, List:new())
127127
end),
128128
test('metatable of result is pandoc.List', function ()
129-
local test = List:new{5}
130-
assert.are_equal(List, getmetatable(test))
129+
local out = List:new{5}
130+
assert.are_equal(List, getmetatable(out))
131131
end)
132132
},
133133

tools/moduledeps.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ end
1414

1515
if not (mode == "tree" or mode == "transitive") then
1616
io.write("Usage: lua moduledeps (tree|transitive) modulename\n")
17-
io.exit(1)
17+
os.exit(1)
1818
end
1919

2020
if #roots == 0 then
2121
io.write("Usage: lua moduledeps modulename+\n")
22-
io.exit(1)
22+
os.exit(1)
2323
end
2424

2525
for line in lines do

tools/update-lua-module-docs.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ local function render_type (name, level, modulename)
198198
local methods = Blocks{}
199199
if next(metatable.methods) then
200200
local attr = {'type-' .. id .. '-methods'}
201-
methods:insert(Header(level + 1, "Methods", mattr))
202-
for name, method in sorted(metatable.methods) do
203-
-- attr = {'type-' .. modulename .. '.' .. name .. '.' .. name}
204-
-- methods:insert(Header(level + 2, name, attr))
201+
methods:insert(Header(level + 1, "Methods", attr))
202+
for propname, method in sorted(metatable.methods) do
203+
-- attr = {'type-' .. modulename .. '.' .. name .. '.' .. propname}
204+
-- methods:insert(Header(level + 2, propname, attr))
205205
methods:extend(render_function(documentation(method), level+2, id))
206206
end
207207
end

0 commit comments

Comments
 (0)