Jump to content

Module:T-Organization

Documentation for this module may be created at Module:T-Organization/doc

--Module:T-Organization
-- Makes use of ICANNWiki's "Template Blueprint Framework" to render the "Organization" template

local p = {}

-- ==================== Required modules ====================
local Blueprint = require('Module:LuaTemplateBlueprint')
local ErrorHandling = require('Module:ErrorHandling')
local LinkParser = require('Module:LinkParser')

-- ==================== Helper Functions ====================
-- Blueprint default: Create error context for the module
local errorContext = ErrorHandling.createContext("T-Organization")

-- ================================================================================

-- IMPORTANT! TEMPLATE BLUEPRINT FRAMEWORK INSTRUCTIONS
-- CONTROL OF TEMPLATE FEATURES: THIS LIST SPECIFIES IN AN EXPLICIT MANNER WHAT FEATURES ARE TO BE CALLED/RENDERED BY THE TEMPLATE.
local template = Blueprint.registerTemplate('Organization', {
    features = {
        title = true,
        logo = true,
        fields = true,
        socialMedia = true,
        semanticProperties = true,
        categories = true,
        errorReporting = true,
    }
})

-- Blueprint default: Initialize standard configuration
Blueprint.initializeConfig(template)

-- CONTROL THE VISUAL ORDER THAT EACH ASPECT IS RENDERED IN
template.config.blockSequence = {
    'title',
    'logo',
    'fields',
    'socialMedia',
    'semanticProperties',
    'categories',
    'errors'
}

-- ================================================================================

-- TEMPLATE-SPECIFIC CALLS AND CODE

-- SPECIAL SEMANTIC MAPPINGS GO HERE

-- ================================================================================

-- ==================== Preprocessors ====================
-- Basic preprocessors
Blueprint.addPreprocessor(template, 'setPageIdField')  -- Blueprint default
Blueprint.addPreprocessor(template, 'deriveRegionFromCountry') -- Possible blueprint default

-- ==================== Main Render Function ====================
-- Blueprint default: Render
function p.render(frame)
    return ErrorHandling.protect(
        errorContext,
        "render",
        function()
            return template.render(frame)
        end,
        ErrorHandling.getMessage("TEMPLATE_RENDER_ERROR"),
        frame
    )
end

return p