Content deleted Content added
m undo until I come up with a working version |
I think I finally made it work |
||
Line 48:
local sectionParameter = frame.args[1]
local output, sign = "", ""
local sections, postscripts, separators = {}, {}, {}
local part = frame.args[2]
if sectionParameter then
n = 1
if find(sectionParameter, "[^%d%s]") then
for number, postscript, separator in gmatch(sectionParameter, "(%d
▲ if sections[n] == "" and separators[n] == "" then
break
end
Line 70 ⟶ 61:
end
else
sections[1], separators[1] = match(sectionParameter, "(%d
end
else
error("SmythSection wants input in the first parameter")
end
if #sections == nil
error("No numbers in the text provided to SmythSection")
elseif sections[2] == "" or sections[2] == nil then
sign = "§"
else
Line 83 ⟶ 74:
end
for i = 1, #sections do
if sections[i] == "" or sections[i] == nil then -- Does gmatch return nil or an empty string when it finds no match?
break
else
if not postscripts[i] then postscripts[i] = "" end
if not separators[i] then separators[i] = "" end
output = output .. "[" .. Smyth(
if i == 1 then
output = output .. " " .. sign
end
output = output .. " " .. sections[i] .. postscripts[i] .. "]" .. separators[i]
end
end
|