Content deleted Content added
m subsections are sometimes lettered instead of numbered |
adding a function to generate Part names for Smyth refs; this is much simpler than using a template since regex has to be used to find the first number |
||
Line 3:
data = {
["Smyth"] = {
["path"] = "1999.04.0007"
}
}
Line 21 ⟶ 20:
SmythData = data.Smyth
path = SmythData.path
return url(path, part, section)▼
sectionNumber = tonumber(section)
if sectionNumber < 189 then
Part = "Part I: Letters, Sounds, Syllables, Accent"
elseif sectionNumber < 822 then
Part = "Part II: Inflection"
elseif sectionNumber < 900 then
Part = "Part III: Formation of Words"
elseif sectionNumber < 3049 then
Part = "Part IV: Syntax"
else
error("The largest valid section number is 3048")
end
▲ return { url = url(path, part, section), Part = Part }
end
function export.SmythSection(frame)
▲ local output, sign = "", ""
local sectionParameter = frame.args[1]
local output, sign = "", ""
local sections, separators = {}, {}
local part = frame.args[2]
Line 66 ⟶ 78:
else
local sectionPath = string.gsub(sections[i], "%.%d", "")
output = output .. "[" .. Smyth(sectionPath).url
if i == 1 then
output = output .. " " .. sign
Line 74 ⟶ 86:
end
return output
end
function export.SmythPart(frame)
local sectionParameter = frame.args[1]
local section = match(sectionParameter, "(%d+)")
return Smyth(section).Part
end
|