Module:SemanticAnnotations: Difference between revisions
// via Wikitext Extension for VSCode Tag: Manual revert |
// via Wikitext Extension for VSCode |
||
| Line 161: | Line 161: | ||
local param = mappingEntry.param | local param = mappingEntry.param | ||
local metadata = mappingEntry.metadata or {} | local metadata = mappingEntry.metadata or {} | ||
local value = args[param] | -- Case-insensitive lookup: try exact match first, then lowercase | ||
local value = args[param] or args[param:lower()] | |||
if value and value ~= "" then | if value and value ~= "" then | ||
| Line 229: | Line 230: | ||
if type(mapping) == "string" then | if type(mapping) == "string" then | ||
-- Simple string mapping | -- Simple string mapping with case-insensitive lookup | ||
local value = args[mapping] or args[mapping:lower()] | |||
propertyCount = propertyCount + addSimplePropertyToResult(result, | propertyCount = propertyCount + addSimplePropertyToResult(result, | ||
fullPropertyName, | fullPropertyName, value, transform[property], default[property]) | ||
elseif type(mapping) == "table" then | elseif type(mapping) == "table" then | ||
if mapping.param then | if mapping.param then | ||
-- Object with param structure | -- Object with param structure with case-insensitive lookup | ||
local value = args[mapping.param] or args[mapping.param:lower()] | |||
propertyCount = propertyCount + addSimplePropertyToResult(result, | propertyCount = propertyCount + addSimplePropertyToResult(result, | ||
fullPropertyName, | fullPropertyName, value, transform[property], default[property]) | ||
elseif mapping.mappings then | elseif mapping.mappings then | ||
-- Complex mapping with multiple parameters | -- Complex mapping with multiple parameters | ||
| Line 242: | Line 245: | ||
local param = mappingEntry.param | local param = mappingEntry.param | ||
local metadata = mappingEntry.metadata or {} | local metadata = mappingEntry.metadata or {} | ||
local value = args[param] | -- Case-insensitive lookup | ||
local value = args[param] or args[param:lower()] | |||
if value and value ~= "" then | if value and value ~= "" then | ||
| Line 311: | Line 315: | ||
if type(mapping) == "string" then | if type(mapping) == "string" then | ||
-- Simple string mapping | -- Simple string mapping with case-insensitive lookup | ||
processSimpleMapping(properties, fullPropertyName, | -- Try exact match first, then lowercase | ||
local value = args[mapping] or args[mapping:lower()] | |||
processSimpleMapping(properties, fullPropertyName, value, transform[property], default[property]) | |||
elseif type(mapping) == "table" then | elseif type(mapping) == "table" then | ||
if mapping.is_subobject then | if mapping.is_subobject then | ||
| Line 369: | Line 375: | ||
end | end | ||
elseif mapping.param then | elseif mapping.param then | ||
-- Single mapping with object structure | -- Single mapping with object structure with case-insensitive lookup | ||
processSimpleMapping(properties, fullPropertyName, | local value = args[mapping.param] or args[mapping.param:lower()] | ||
processSimpleMapping(properties, fullPropertyName, value, transform[property], default[property]) | |||
elseif mapping.mappings then | elseif mapping.mappings then | ||
-- Complex mapping with multiple parameters | -- Complex mapping with multiple parameters | ||