Module:government: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 110: Line 110:
end
end
return to_Return
return to_Return
end
local temp_main = ""
local function temp_append(text)
temp_main = temp_main .. text
end
end
local form, colour
local form, colour
Line 115: Line 119:
local link = mw.ustring.match(temp, "^%:([^%(%<%[%+%/]+)")
local link = mw.ustring.match(temp, "^%:([^%(%<%[%+%/]+)")
link = mw.ustring.gsub(link, "%s+$", "")
link = mw.ustring.gsub(link, "%s+$", "")
append("'''" .. m_links.full_link{language = language, term = link} .. "'''")
temp_append("'''" .. m_links.full_link{language = language, term = link} .. "'''")
remove_temp("^%:[^%(%<%[%+%/]+")
remove_temp("^%:[^%(%<%[%+%/]+")
if mw.ustring.find(temp, "^%([^%)]+%)") then
if mw.ustring.find(temp, "^%([^%)]+%)") then
Line 124: Line 128:
remove_temp("^%[[^%]]+%]")
remove_temp("^%[[^%]]+%]")
end
end
append(" (+ " .. glossary(form, colour) .. ")")
temp_append(" (+ " .. glossary(form, colour) .. ")")
end
end
elseif mw.ustring.match(temp, "^[^%(%<%[%+%/]+") then
elseif mw.ustring.match(temp, "^[^%(%<%[%+%/]+") then
Line 134: Line 138:
remove_temp("^%[[^%]]+%]")
remove_temp("^%[[^%]]+%]")
end
end
append(glossary(form, colour))
temp_append(glossary(form, colour))
if args["pos"] then
if args["pos"] then
if data[form] then form = data[form].label end
if data[form] then form = data[form].label end
append("[[Category:" .. language.name .. " " .. pluralize(args["pos"]) .. " governing the " .. form .. "]]")
temp_append("[[Category:" .. language.name .. " " .. pluralize(args["pos"]) .. " governing the " .. form .. "]]")
end
end
else
else
error("Invalid parameter format")
error("Invalid parameter format")
end
end
if mw.ustring.find(temp, "^%<[^%>]+%>") then
local t, q, qq = "", "", ""
local t = mw.ustring.match(temp, "^%<([^%>]+)%>")
while mw.ustring.find(temp, "^%<[^%>]+%>") do
append(" <small>‘".. t .."’</small>")
local content = mw.ustring.match(temp, "^%<([^%>]+)%>")
if mw.ustring.sub(content, 1, 2) == "q:" then
q = "(''" .. mw.ustring.sub(content, 3) .. "'') "
elseif mw.ustring.sub(content, 1, 3) == "qq:" then
qq = " (''" .. mw.ustring.sub(content, 4) .. "'')"
elseif mw.ustring.sub(content, 1, 3) == "q*:" then
show = "[(''" .. mw.ustring.sub(content, 4) .. "'') " mw.ustring.sub(show, 2)
else
t = " <small>‘".. content .."’</small>"
end
remove_temp("^%<[^%>]+%>")
remove_temp("^%<[^%>]+%>")
end
end
append(q .. temp_main .. q .. t)
end
end
end
end