10,735
edits
TheNightAvl (talk | contribs) mNo edit summary |
TheNightAvl (talk | contribs) m (Added slash split functionality) |
||
Line 6: | Line 6: | ||
local function make_labels(inflections) | local function make_labels(inflections) | ||
local out = {} | local out = {} | ||
-- split parameters at / and , | |||
while inflections[it] do | |||
if mw.ustring.find(inflections[it], "^[^,]+,%s.+") then | |||
local before = mw.ustring.gsub(inflections[it], "^([^,]+),%s*(.+)", "%1") | |||
local after = mw.ustring.gsub(inflections[it], "^([^,]+),%s*(.+)", "%2") | |||
inflections[it] = before | |||
table.insert(inflections, it + 1, after) | |||
end | |||
if mw.ustring.find(inflections[it], "^[^/]+/.+") then | |||
local before = mw.ustring.gsub(inflections[it], "^([^/]+)/(.+)", "%1") | |||
local after = mw.ustring.gsub(inflections[it], "^([^/]+)/(.+)", "%2") | |||
inflections[it] = before | |||
table.insert(inflections, it + 1, after) | |||
table.insert(inflections, it + 1, "/") | |||
end | |||
it = it + 1 | |||
end | |||
for i, inflection in ipairs(inflections) do | for i, inflection in ipairs(inflections) do | ||
if m_data.aliases[inflection] then inflection = m_data.aliases[inflection] end | if m_data.aliases[inflection] then inflection = m_data.aliases[inflection] end |