Module:LuaTemplateBlueprint: Difference between revisions

// via Wikitext Extension for VSCode
// via Wikitext Extension for VSCode
Line 929: Line 929:
                     end
                     end
                      
                      
                     -- Process each value individually through deduplication
                     -- Process each value individually
                     for _, singleValue in ipairs(values) do
                     for _, singleValue in ipairs(values) do
                         local trimmedValue = singleValue:match("^%s*(.-)%s*$")
                         local trimmedValue = singleValue:match("^%s*(.-)%s*$")
                         if trimmedValue and trimmedValue ~= '' then
                         if trimmedValue and trimmedValue ~= '' then
                             local transformed = applyTransform(trimmedValue, property, transform, args, template)
                            -- Apply transform if available
                             if transformed and transformed ~= '' then
                             local finalValue = trimmedValue
                                 deduplicateProperty(collector, property, transformed)
                            if transform then
                                finalValue = p.protectedExecute(
                                    template,
                                    'Transform_' .. property,
                                    function() return transform(trimmedValue, args, template) end,
                                    trimmedValue,
                                    trimmedValue,
                                    args,
                                    template
                                )
                            end
                           
                            -- Validate and add to collector
                            finalValue = validatePropertyValue(finalValue)
                             if finalValue and finalValue ~= '' then
                                 if not collector.properties[property] then
                                    collector.properties[property] = {}
                                end
                                table.insert(collector.properties[property], finalValue)
                                collector.count = collector.count + 1
                             end
                             end
                         end
                         end