Module:T-Process: Difference between revisions

// via Wikitext Extension for VSCode
// via Wikitext Extension for VSCode
Line 62: Line 62:
end
end


-- Preprocessor for semantic property extraction
-- Get the SemanticCategoryHelpers module
Blueprint.addPreprocessor(template, function(template, args)
local SemanticCategoryHelpers = require('Module:SemanticCategoryHelpers')
    -- Extract plain text from wiki links for has_previous and has_next
    args._semanticPrecededBy = extractSemanticValue(args.has_previous, "Preceded By")
    args._semanticSucceededBy = extractSemanticValue(args.has_next, "Succeeded By")
   
    return args
end)


-- Configure semantic properties to use extracted values
-- Register a property provider using the new helper function
template.config.semantics = template.config.semantics or {}
Blueprint.registerPropertyProvider(
template.config.semantics.properties = template.config.semantics.properties or {}
    template,
template.config.semantics.additionalProperties = template.config.semantics.additionalProperties or {}
    SemanticCategoryHelpers.createCombinedPropertyProvider(
template.config.semantics.additionalProperties[require('Module:ConfigRepository').semanticProperties.process_connection] = {"process", "_semanticPrecededBy", "_semanticSucceededBy"}
        {"process", "has_previous", "has_next"}, -- Fields to combine
        require('Module:ConfigRepository').semanticProperties.process_connection, -- Property to set
        function(value, fieldName) -- Extractor function
            return extractSemanticValue(value, fieldName)
        end
    )
)


-- ========== Main Render Function ==========
-- ========== Main Render Function ==========