Module:Autonumber: Difference between revisions
(support tables instead of plain text.) |
Vivaporius (talk | contribs) m (1 revision imported) |
(No difference)
|
Latest revision as of 06:36, 27 May 2017
Documentation for this module may be created at Module:Autonumber/doc
local p = {}
function p.main(frame)
local args = frame.args
local pos = {1}
local count = 0
local i = 1
while args[i] ~= nil do
pos[i] = string.find(args[i], "#", (pos[i] or 1)+1)
if string.find(args[i], "#") then
count = count + 1
end
args[i] = string.gsub(args[i], "#", count, 1)
i = i + 1
end
table.insert(args, 2, "class=" .. args.class .. "\n")
return table.concat(args, "|")
end
return p