Module:Crh: Difference between revisions

Content deleted Content added
allow use-cases without Latin text
added custom label param
 
Line 13:
 
-- Helper function to parse boolean parameters
local function isFalse(value)
if value == "no" or value == "n" or value == "false" or value == "0" or value == "off" or value == "none" then
return true
else
return false
end
end
 
local function parseBoolean(value, default)
if value == nil then
Line 20 ⟶ 28:
if value == "yes" or value == "y" or value == "true" or value == "1" or value == "on" then
return true
elseif isFalse(value == "no" or value == "n" or value == "false" or value == "0" or value == "off") then
return false
end
Line 49 ⟶ 57:
local link = parseBoolean(args["link"], true)
local lead = parseBoolean(args["lead"], true)
local label = args["label"]
local labelOnly = parseBoolean(args["label-only"], true)
 
Line 54 ⟶ 63:
local parts = {}
 
if lead and linklabel then
if not isFalse(label) then
table.insert(output, "[[Crimean Tatar language|Crimean Tatar]]: ")
table.insert(output, "Crimeanlabel Tatar.. ": ")
elseif lead and not link then
else
table.insert(output, "Crimean Tatar: ")
end
elseif lead then
if link then
table.insert(output, "[[Crimean Tatar language|Crimean Tatar]]: ")
else
table.insert(output, "Crimean Tatar: ")
end
end
 
-- if label and not isFalse(label) then
-- table.insert(parts, label .. ":")
-- elseif label and isFalse(label) then
-- do return end
-- elseif lead and link then
-- table.insert(output, "[[Crimean Tatar language|Crimean Tatar]]: ")
-- elseif lead and not link then
-- table.insert(output, "Crimean Tatar: ")
-- end
 
if latinText then