Module:TemplateHelpers: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| Line 1: | Line 1: | ||
-- Module:TemplateHelpers | -- Module:TemplateHelpers | ||
-- Common helper functions for template modules | -- Common helper functions for template modules promoting code reuse and consistency. | ||
-- Provides utilities for string processing, field handling, normalization, and block rendering. | |||
local p = {} | local p = {} | ||
| Line 508: | Line 509: | ||
-- Generates semantic properties based on configuration | -- Generates semantic properties based on configuration | ||
-- @param args - Template parameters | -- @param args - Template parameters | ||
-- @param semanticConfig - | -- @param semanticConfig - Config with properties, transforms, additionalProperties | ||
-- @param options - Options | -- @param options - Options: transform (functions), skipProperties (to exclude) | ||
-- @return Wikitext with semantic annotations | |||
-- @return Wikitext | |||
function p.generateSemanticProperties(args, semanticConfig, options) | function p.generateSemanticProperties(args, semanticConfig, options) | ||
if not args or not semanticConfig then return "" end | if not args or not semanticConfig then return "" end | ||
| Line 544: | Line 543: | ||
-- Creates a standardized configuration structure for template modules | -- Creates a standardized configuration structure for template modules | ||
function p.createStandardConfig(config) | function p.createStandardConfig(config) | ||
config = config or {} | config = config or {} | ||