Module:Param Parse: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(if variant is N/A, prevent writing to SMW since the SMW parameter is of datatype page)
(Make sure name doesn't include variant when it's set to N/A)
Line 447: Line 447:
end
end
function parse.variant_category_func(v)
function parse.variant_category_func(v)
v = parse.has_content(v)
if v == nil then
if v == nil then
return nil
return nil
Line 467: Line 468:
end
end
local function name_without_variant_category(name, variant_name)
local function name_without_variant_category(name, variant_name)
if name:sub(-1-#variant_name) == ' '..variant_name then
variant_name = parse.variant_smw_func(variant_name)
if variant_name and name:sub(-1-#variant_name) == ' '..variant_name then
-- Ends with the variant name. Remove it
-- Ends with the variant name. Remove it
name = name:sub(1, -2-#variant_name)
name = name:sub(1, -2-#variant_name)
Line 474: Line 476:
end
end
local function name_with_variant_category(name, v, passive, is_for_smw)
local function name_with_variant_category(name, v, passive, is_for_smw)
v = parse.variant_smw_func(v)
if v == nil then
if v == nil then
return name
return name