Module:SemanticAnnotations: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| Line 9: | Line 9: | ||
--[[ Generates semantic annotations using #set parser function | --[[ Generates semantic annotations using #set parser function | ||
@param args - Template parameters | @param args - Template parameters | ||
@param mappings - Property mappings: {["Property"] = "param"} or complex format | @param mappings - Property mappings: {["Property"] = "param"} or complex format | ||
@param options - Config options (visible, prefix, transform, default, conditional) | @param options - Config options (visible, prefix, transform, default, conditional) | ||
@return Wikitext | @return Wikitext with semantic annotations | ||
]] | ]] | ||
function p.generateAnnotations(args, mappings, options) | function p.generateAnnotations(args, mappings, options) | ||
| Line 22: | Line 22: | ||
end | end | ||
-- | -- Set defaults | ||
args = args or {} | args = args or {} | ||
mappings = mappings or {} | mappings = mappings or {} | ||
| Line 257: | Line 257: | ||
--[[ Sets semantic properties with native API or fallback | --[[ Sets semantic properties with native API or fallback | ||
@param args - Template parameters | @param args - Template parameters | ||
@param mappings - Property mappings in | @param mappings - Property mappings in formats: | ||
- Simple: {["Property"] = "param_name"} | - Simple: {["Property"] = "param_name"} | ||
- Object: {["Property"] = {param = "param_name"}} | - Object: {["Property"] = {param = "param_name"}} | ||