Module:government: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 108: Line 108:
else
else
local function glossary(form, colour)
local function glossary(form, colour)
if data[form] then
if mw.ustring.sub(form, 1, 1) == "_" then
form = data[form].label
return mw.ustring.sub(form, 2)
if colour == nil then colour = data[form].colour end
else
if data[form] then
form = data[form].label
if colour == nil then colour = data[form].colour end
end
local to_Return = "''[[Appendix:Glossary#" .. form .. "|" .. form .. "]]''"
if colour then
to_Return = "<span style=\"background-color: #" .. colour .. ";\">" .. to_Return .. "</span>"
end
return to_Return
end
end
local to_Return = "''[[Appendix:Glossary#" .. form .. "|" .. form .. "]]''"
if colour then
to_Return = "<span style=\"background-color: #" .. colour .. ";\">" .. to_Return .. "</span>"
end
return to_Return
end
end
local temp_main = ""
local temp_main = ""
Line 123: Line 127:
end
end
local form, colour
local form, colour
if mw.ustring.find(temp, "^%:[^%(%<%[%+%/]+") then
if mw.ustring.find(temp, "^%:[^%(%<%[%+%/%:]+") then
local link = mw.ustring.match(temp, "^%:([^%(%<%[%+%/]+)")
while mw.ustring.find(temp, "^%:[^%(%<%[%+%/%:]+") do
link = mw.ustring.gsub(link, "%s+$", "")
local link = mw.ustring.match(temp, "^%:([^%(%<%[%+%/%:]+)")
temp_append("'''" .. m_links.full_link{language = language, term = link} .. "'''")
link = mw.ustring.gsub(link, "%s+$", "")
remove_temp("^%:[^%(%<%[%+%/]+")
temp_append("'''" .. m_links.full_link{language = language, term = link} .. "'''")
remove_temp("^%:[^%(%<%[%+%/%:]+")
end
if mw.ustring.find(temp, "^%([^%)]+%)") then
if mw.ustring.find(temp, "^%([^%)]+%)") then
form = mw.ustring.match(temp, "^%(([^%)]+)%)")
form = mw.ustring.match(temp, "^%(([^%)]+)%)")