Module:SemanticAnnotations: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode Tag: Reverted |
||
| Line 3: | Line 3: | ||
local p = {} | local p = {} | ||
local TemplateHelpers = require('Module:TemplateHelpers') | |||
local NormalizationText = require('Module:NormalizationText') | local NormalizationText = require('Module:NormalizationText') | ||
| Line 49: | Line 50: | ||
if type(param) == "string" then | if type(param) == "string" then | ||
local fullPropertyName = prefix .. property | local fullPropertyName = prefix .. property | ||
local value = args | local _, value = TemplateHelpers.getFieldValue(args, { key = param }) | ||
-- Apply transform if needed | -- Apply transform if needed | ||
| Line 68: | Line 69: | ||
for property, condition in pairs(conditional) do | for property, condition in pairs(conditional) do | ||
local fullPropertyName = prefix .. property | local fullPropertyName = prefix .. property | ||
local _, condValue = TemplateHelpers.getFieldValue(args, { key = condition.param }) | |||
if condValue == condition.value then | |||
table.insert(result, string.format(' |%s=%s', fullPropertyName, condition.target or "true")) | table.insert(result, string.format(' |%s=%s', fullPropertyName, condition.target or "true")) | ||
propertyCount = propertyCount + 1 | propertyCount = propertyCount + 1 | ||