Skip to content

Commit d7aa0a0

Browse files
committed
Fix bugs in Lua scripts surfaced by Luacheck
1 parent d6ce50d commit d7aa0a0

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

data/creole.lua

Lines changed: 2 additions & 2 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
@@ -186,5 +186,5 @@ G = P{ "Doc",
186186
}
187187

188188
function Reader(input, reader_options)
189-
return lpeg.match(G, tostring(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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,9 @@ local function render_type (name, level, modulename)
280280
if next(metatable.methods) then
281281
local attr = {'type-' .. id .. '-methods'}
282282
methods:insert(Header(level + 1, "Methods", attr))
283-
for _, method in sorted(metatable.methods) do
284-
-- attr = {'type-' .. modulename .. '.' .. name .. '.' .. name}
285-
-- methods:insert(Header(level + 2, name, attr))
283+
for propname, method in sorted(metatable.methods) do
284+
-- attr = {'type-' .. modulename .. '.' .. name .. '.' .. propname}
285+
-- methods:insert(Header(level + 2, propname, attr))
286286
methods:extend(render_function(documentation(method), level+2, id))
287287
end
288288
end

0 commit comments

Comments
 (0)