Module:ConfigRepository: Difference between revisions

// via Wikitext Extension for VSCode
// via Wikitext Extension for VSCode
 
(34 intermediate revisions by the same user not shown)
Line 50: Line 50:


     -- IMPORTANT: "Logo" is processed automatically whenever it is called as a key by the Template Blueprint, in such a way that it does not need to be declared for any templates in this repository
     -- IMPORTANT: "Logo" is processed automatically whenever it is called as a key by the Template Blueprint, in such a way that it does not need to be declared for any templates in this repository
}
-- Global field patterns used in multiple templates
p.fieldPatterns = {
    itemDelimiter = ";%s*",  -- Matches semicolon followed by optional whitespace
    websitePattern = "^https?://[^%s]+"  -- Matches URLs starting with http:// or https://
}
-- Global field processors for reusable field definitions
p.fieldProcessors = {
    website = {
        list = { mode = 'bullet_custom', bulletChar = '🔗', postProcess = 'website' }
    }
}
}


Line 99: Line 112:
p.dateFormatting = {
p.dateFormatting = {
     useShortMonthNames = true
     useShortMonthNames = true
}
-- Global campaigns configuration
-- Campaigns are defined centrally and specify which templates they can be applied to
p.campaigns = {
    ASP2025 = {
        name = "ASP 2025 Pro Bono Service Provider",
        applicable_templates = {"Person", "Organization"},
        json_config = "ASP2025"
    }
}
}


Line 201: Line 224:
             -- Patterns for event navigation detection
             -- Patterns for event navigation detection
             seriesNumber = "^([%w%s]+)%s+(%d+)$",    -- e.g., "ICANN 76"
             seriesNumber = "^([%w%s]+)%s+(%d+)$",    -- e.g., "ICANN 76"
             seriesYear = "^([%w%s]+)%s+(%d%d%d%d)$"  -- e.g., "IGF 2023"
             seriesYear = "^([%w%s]+)%s+(%d%d%d%d)$", -- e.g., "IGF 2023"
            itemDelimiter = p.fieldPatterns.itemDelimiter,
            websitePattern = p.fieldPatterns.websitePattern
         },
         },
         fields = {
         fields = {
Line 212: Line 237:
             {key="venue", label="Venue"},
             {key="venue", label="Venue"},
             {key="organizer", label="Organizer"},
             {key="organizer", label="Organizer"},
             {keys={"website", "url"}, label=p.fieldLabels.website},
             {keys={"website", "url"}, label=p.fieldLabels.website, list=p.fieldProcessors.website.list},
         },
         },
         semantics = {
         semantics = {
Line 240: Line 265:
     LibraryInterview = {
     LibraryInterview = {
         meta = {
         meta = {
             description = "Library Interview template"
             description = "Library Interview template",
            page_creator = false
         },
         },
         categories = { -- Default categories
         categories = { -- Default categories
Line 302: Line 328:
             norm_type = {
             norm_type = {
                 {canonical = "Act", category = "Acts"},
                 {canonical = "Act", category = "Acts"},
                {canonical = "Agreement", category = "Agreements"},
                {canonical = "Framework", category = "Frameworks"},
                 {canonical = "Law", category = "Laws"},
                 {canonical = "Law", category = "Laws"},
                 {canonical = "Regulation", category = "Regulations"},
                 {canonical = "Regulation", category = "Regulations"},
Line 338: Line 366:
             {key="norm_status", label="Status"}, -- Key used in templatedata
             {key="norm_status", label="Status"}, -- Key used in templatedata
             {key="official_text", label="Official text"},
             {key="official_text", label="Official text"},
             {key="related_norm", label="Related Norms"},
             {key="related_norm", label="Related Norms", list="bullet"},
             {key="parent_framework", label="Parent legal framework", autoWikiLink=true},
             {key="parent_framework", label="Parent legal framework", autoWikiLink=true},
             {key="norm_language", label="Language"}
             {key="norm_language", label="Language"}
Line 387: Line 415:
         mappings = {
         mappings = {
             organization_type = {
             organization_type = {
            -- organization_type (Property:Has organization type)
                 {canonical = "Academic institution",
                 {canonical = "Academic institution",
                     synonyms = {"university", "college", "academia", "institute", "school"},
                     synonyms = {"university", "college", "academia", "institute", "school"},
Line 394: Line 423:
                     category = "ALS"},
                     category = "ALS"},
                 {canonical = "Commercial",
                 {canonical = "Commercial",
                     synonyms = {"for-profit", "for profit", "business", "private", "private company", "privately held", "company", "publicly held", "joint stock company", "corporation", "corp", "firm", "enterprise", "limited liability", "llc", "gmbh"},
                     synonyms = {"for-profit", "for profit", "business", "private", "private company", "privately held", "company", "publicly held", "public", "joint stock company", "corporation", "corp", "firm", "enterprise", "limited liability", "llc", "gmbh"},
                     category = "Commercial"},
                     category = "Commercial"},
                 {canonical = "Community network",
                 {canonical = "Community network",
Line 423: Line 452:
                     synonyms = {"public-private partnership", "ppp"},
                     synonyms = {"public-private partnership", "ppp"},
                     category = "Public-private partnership"},
                     category = "Public-private partnership"},
                {canonical = "Research institute",
                    synonyms = {"research", "institute", "think tank"},
                    category = "Research institute"},
                 {canonical = "Standards development organization",
                 {canonical = "Standards development organization",
                     synonyms = {"sdo", "standards body", "standards organisation"},
                     synonyms = {"sdo", "standards body", "standards organisation, standards"},
                     category = "Standards development organization"}
                     category = "Standards development organization"}
             }
             }
        },
        patterns = {
            itemDelimiter = p.fieldPatterns.itemDelimiter,
            websitePattern = p.fieldPatterns.websitePattern
         },
         },
         fields = {
         fields = {
Line 435: Line 471:
             {key="city", label=p.fieldLabels.city},
             {key="city", label=p.fieldLabels.city},
             {key="date_founded", label="Founded"},
             {key="date_founded", label="Founded"},
             {key="founders", label="Founders"},
             {key="founders", label="Founders", autoWikiLink=true, list="bullet"},
             {key="ownership", label="Ownership", autoWikiLink=true},
             {key="ownership", label="Ownership", autoWikiLink=true},
             {key="subsidiaries", label="Subsidiaries"},
             {key="subsidiaries", label="Subsidiaries", list="bullet"},
             {keys={"website", "url"}, label=p.fieldLabels.website},
             {keys={"website", "url"}, label=p.fieldLabels.website, list=p.fieldProcessors.website.list},
         },
         },
         semantics = {
         semantics = {
Line 477: Line 513:
             -- REVIEW Community (Property:Has governance community)
             -- REVIEW Community (Property:Has governance community)
             community = {
             community = {
                -- Broad definition
                {canonical = "Internet Governance Community",
                    synonyms = {"ig", "internet governance"},
                    category = "Internet Governance Community"},
                 -- ICANN-related communities
                 -- ICANN-related communities
                 {canonical = "ICANN Community",
                 {canonical = "ICANN Community",
                     synonyms = {"icann", "community"},
                     synonyms = {"icann", "community"},
                     category = "ICANN Community"},
                     category = "ICANN Community"},
                 {canonical = "ICANN Staff",
                 {canonical = "ICANN Staff", -- Category provided via "badge-icann-staff"
                     synonyms = {"staff", "icann org"},
                     synonyms = {"staff", "icann org"},},
                    category = "ICANN Staff"},
                 -- Technical communities
                 -- Technical communities
                 {canonical = "Technical Community",
                 {canonical = "Technical Community",
Line 512: Line 551:
                 -- Government-related
                 -- Government-related
                 {canonical = "Governmental",
                 {canonical = "Governmental",
                     synonyms = {"government", "public sector"},
                     synonyms = {"government", "public sector", "gac"},
                     category = "Governmental"},
                     category = "Governmental"},
                 {canonical = "Intergovernmental",
                 {canonical = "Intergovernmental",
Line 521: Line 560:
         fields = {
         fields = {
             {key="community", label="Community"},
             {key="community", label="Community"},
             {key="icann_group", label="ICANN group", autoWikiLink=true}, -- (Property:Has ICANN affiliation)
             {key="icann_group", label="ICANN SO/AC", autoWikiLink=true}, -- (Property:Has ICANN affiliation)
             {key="organization", label="Organization", autoWikiLink=true},
             {key="organization", label="Organization", autoWikiLink=true, list="bullet"},
             {key="region", label=p.fieldLabels.region},
             {key="region", label=p.fieldLabels.region, list="bullet"},
             {key="country", label=p.fieldLabels.country},
             {key="country", label=p.fieldLabels.country},
             {key="languages", label="Languages"},
             {key="languages", label="Languages", list = { mode = 'bullet_custom', bulletChar = '🗣️', postProcess = 'language' }},
             {key="website", label=p.fieldLabels.website},
             {key="website", label=p.fieldLabels.website, list=p.fieldProcessors.website.list},
             {key="soi", label="SOI"},
             {key="soi", label="SOI"},
             {key="userbox", label="Achievements"},
             {key="userbox", label="Achievements"},
Line 532: Line 571:
         },
         },
         patterns = {
         patterns = {
             itemDelimiter = ";%s*", -- Matches semicolon followed by optional whitespace; used for splitting multi-value fields
             itemDelimiter = p.fieldPatterns.itemDelimiter,
             websitePattern = "^https?://[^%s]+"  -- Matches URLs starting with http:// or https:// followed by non-whitespace chars
             websitePattern = p.fieldPatterns.websitePattern
         },
         },
         semantics = {
         semantics = {
Line 544: Line 583:
             -- Normalizations applied
             -- Normalizations applied
             transforms = {
             transforms = {
                 ["Has governance community"] = "normalize",
                 ["Has governance community"] = "normalize"
                ["Knows language"] = "raw"
             },
             },
             fixedProperties = {
             fixedProperties = {
Line 724: Line 762:
         patterns = {
         patterns = {
             tldExtension="%.([^%.]+)$",  -- Extracts the TLD part after the last dot (e.g., "com" from "example.com")
             tldExtension="%.([^%.]+)$",  -- Extracts the TLD part after the last dot (e.g., "com" from "example.com")
             countryDelimiter="([^;]+)"  -- Matches any sequence of characters not containing semicolons; used for country parsing
             countryDelimiter="([^;]+)",   -- Matches any sequence of characters not containing semicolons; used for country parsing
            itemDelimiter = p.fieldPatterns.itemDelimiter,
            websitePattern = p.fieldPatterns.websitePattern
         },
         },
         fields = {
         fields = {
Line 739: Line 779:
             {key="ascii", label="Punycode"},
             {key="ascii", label="Punycode"},
             {key="registry", label="Registry", autoWikiLink=true},
             {key="registry", label="Registry", autoWikiLink=true},
             {key="website", label=p.fieldLabels.website},
             {key="website", label=p.fieldLabels.website, list=p.fieldProcessors.website.list},
             {keys={"RVC", "PIC"}, label = "PIC/RVC"}
             {keys={"RVC", "PIC"}, label = "PIC/RVC"}
         },
         },
Line 887: Line 927:
     -- Create a standard config
     -- Create a standard config
     return p.createStandardConfig(baseConfig, customOverrides, templateType)
     return p.createStandardConfig(baseConfig, customOverrides, templateType)
end
function p.getSemanticPropertyName(propertyKey)
    for templateName, templateConfig in pairs(p.templates) do
        if templateConfig.semantics and templateConfig.semantics.additionalProperties then
            if templateConfig.semantics.additionalProperties[propertyKey] then
                return propertyKey
            end
        end
    end
    return nil
end
end


return p
return p