require('strict')
local p =
-- Errorslocal err_category =
local function errorMessage(error) return '
Error in crh template: ' end-- Helper function to parse boolean parameterslocal function isFalse(value) if value
"n" or value
"0" or value
"none" then return true else return false endend
local function parseBoolean(value, default) if value
"string" then value = value:lower if value
"y" or value
"1" or value
-- Helper function to get parameter value, considering aliaseslocal function getParamValue(params, paramName, aliases) local value = params[paramName] if value
-- Main function to render textfunction p.renderText(frame) local args = require ('Module:Arguments').getArgs (frame); local latinText = args[1] local cyrillicText = args[2] local arabicText = args[3] local literalTranslation = getParamValue(args, "lit",) local link = parseBoolean(args["link"], true) local lead = parseBoolean(args["lead"], true) local label = args["label"] local labelOnly = parseBoolean(args["label-only"], true)
local output = local parts =
if label then if not isFalse(label) then table.insert(output, label .. ": ") else end elseif lead then if link then table.insert(output, "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: ") -- elseif lead and not link then -- table.insert(output, "Crimean Tatar: ") -- end
if latinText then local spannedLatin = "
" .. latinText .. "" if lead and not labelOnly and link then table.insert(parts, "Latin: " .. spannedLatin .. "") elseif lead and not labelOnly and link then table.insert(parts, "Latin: " .. spannedLatin .. "") else table.insert(parts, "" .. spannedLatin .. "") end endif cyrillicText then local spannedCyrillic = "
" .. cyrillicText .. "" if not labelOnly and link then table.insert(parts, "Cyrillic: " .. spannedCyrillic) elseif cyrillicText and not labelOnly and not link then table.insert(parts, "Cyrillic: " .. spannedCyrillic) elseif cyrillicText and labelOnly then table.insert(parts, spannedCyrillic) end end if arabicText then local spannedArabic = "" .. arabicText .. ""if not labelOnly and link then table.insert(parts, "Arabic: " .. spannedArabic) elseif not labelOnly and not link then table.insert(parts, "Arabic: " .. spannedArabic) elseif labelOnly then table.insert(parts, spannedArabic) end end
if literalTranslation and link then table.insert(parts, "lit. '" .. literalTranslation .. "'") elseif literalTranslation and not link then table.insert(parts, "lit. '" .. literalTranslation .. "'") end
table.insert(output, table.concat(parts, ", "))
return table.concat(output)end
return p