Module:SemanticCategoryHelpers: Difference between revisions
// via Wikitext Extension for VSCode Tag: Manual revert |
// via Wikitext Extension for VSCode |
||
| Line 122: | Line 122: | ||
p.SEMICOLON_PATTERN = {{pattern = ";%s*", replacement = ";"}} | p.SEMICOLON_PATTERN = {{pattern = ";%s*", replacement = ";"}} | ||
-- Helper function to check if a field contains multiple values | -- Helper function to check if a field contains multiple values | ||
| Line 208: | Line 202: | ||
else | else | ||
-- Default to splitting the string | -- Default to splitting the string | ||
items = | items = TemplateHelpers.splitMultiValueString(value) | ||
end | end | ||
| Line 239: | Line 233: | ||
-- This is now a wrapper around splitMultiValueString for backward compatibility | -- This is now a wrapper around splitMultiValueString for backward compatibility | ||
function p.splitRegionCategories(regionValue) | function p.splitRegionCategories(regionValue) | ||
return | return TemplateHelpers.splitMultiValueString(regionValue) | ||
end | end | ||
| Line 289: | Line 283: | ||
else | else | ||
-- Default to splitting the string | -- Default to splitting the string | ||
items = | items = TemplateHelpers.splitMultiValueString(value) | ||
end | end | ||
| Line 400: | Line 394: | ||
if value and value ~= "" then | if value and value ~= "" then | ||
-- Split multi-value fields | -- Split multi-value fields | ||
local values = | local values = TemplateHelpers.splitMultiValueString(value) | ||
-- For each value, transform if needed and add to property collection | -- For each value, transform if needed and add to property collection | ||
| Line 517: | Line 511: | ||
local transform = semanticConfig.transforms[property] | local transform = semanticConfig.transforms[property] | ||
if transform and type(transform) == "function" then | if transform and type(transform) == "function" then | ||
local items = | local items = TemplateHelpers.splitMultiValueString(value) | ||
for _, item in ipairs(items) do | for _, item in ipairs(items) do | ||
local transformed = transform(item) | local transformed = transform(item) | ||