Module:LuaTemplateBlueprint: Difference between revisions

// via Wikitext Extension for VSCode
// via Wikitext Extension for VSCode
Line 1,089: Line 1,089:
         and centralizes normalization logic for clarity and consistency.
         and centralizes normalization logic for clarity and consistency.
     ]]
     ]]
     -- Override raw country/region with normalized names
     -- Override raw country/region with normalized names if country field exists
     local cr = require('Module:ConfigRepository')
     if args.country and args.country ~= '' then
    local cd = require('Module:CountryData')
        local cr = require('Module:ConfigRepository')
    local norm = p.protectedExecute(
        local cd = require('Module:CountryData')
        template,
        local norm = p.protectedExecute(
        'CountryData_Override',
            template,
        function() return cd.getSemanticCountryRegionProperties(args.country) end,
            'CountryData_Override',
        {},
            function() return cd.getSemanticCountryRegionProperties(args.country) end,
        args.country
            {},
    )
            args.country
    local countryKey = cr.semanticProperties.country
        )
    local regionKey = cr.semanticProperties.region
        if norm then
    allProperties[countryKey] = norm[countryKey]
            local countryKey = cr.semanticProperties.country
    allProperties[regionKey] = norm[regionKey]
            local regionKey = cr.semanticProperties.region
            if norm[countryKey] then
                collector.properties[countryKey] = norm[countryKey]
            end
            if norm[regionKey] then
                collector.properties[regionKey] = norm[regionKey]
            end
        end
    end
   
    -- Send all deduplicated properties to SemanticAnnotations in one batch
     local semanticOutput = SemanticAnnotations.setSemanticProperties(
     local semanticOutput = SemanticAnnotations.setSemanticProperties(
         args,
         args,
         allProperties,
         collector.properties,
         semanticOptions
         semanticOptions
     )
     )