Module:SemanticAnnotations: Difference between revisions

// via Wikitext Extension for VSCode
Tags: Manual revert Reverted
Undo revision 1364961 by MarkWD (talk)
Tags: Undo 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 50: Line 49:
         if type(param) == "string" then
         if type(param) == "string" then
             local fullPropertyName = prefix .. property
             local fullPropertyName = prefix .. property
             local _, value = TemplateHelpers.getFieldValue(args, { key = param })
             local value = args[param]
              
              
             -- Apply transform if needed
             -- Apply transform if needed
Line 69: Line 68:
     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 args[condition.param] and args[condition.param] == condition.value then
        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