词条 | Module:NPVIC status |
释义 | local p = {} function p.states(frame) local states = frame:expandTemplate{ title = 'section transclude', args = { frame.args['section'] } } local total = 0 for state in mw.ustring.gmatch( states, "%a%a" ) do if state~='DC' then total = total + 1 end end if total==0 then return frame:expandTemplate{ title = 'error', args = { 'Value not available when editing this section in isolation.' } } else if frame.args[1]=='spell' then total = frame:expandTemplate{ title = 'spellnum per MOS', args = { total } } end return total end end function p.EVs(frame) local states = frame:expandTemplate{ title = 'section transclude', args = { frame.args['section'] } } if states == then states = frame.args[1] end if not states then return frame:expandTemplate{ title = 'error', args = { 'Value not available when editing this section in isolation.' } } else local total = 0 for state in mw.ustring.gmatch( states, "%a%a" ) do seats = frame:expandTemplate{ title = 'USHRseats', args = { state } } if state=='DC' then seats=1 end if type(tonumber(seats))=='nil' then total = error("Unrecognized state") break else total = total + seats + 2 end end return total end end function p.overlays(frame) local states = frame:expandTemplate{ title = 'section transclude', args = { frame.args['section'] } } local size = frame.args['size'] or '325px' if frame.args['section']=='passed' then color = 'green' elseif frame.args['section']=='pending' then color = 'yellow' end
local overlays = for state in mw.ustring.gmatch( states, "%a%a" ) do state_overlay = ' 'overlays = overlays .. state_overlay end return overlays end function p.signatories(frame) local states = frame:expandTemplate{ title = 'section transclude', args = { 'passed' } } local signatories = for state in mw.ustring.gmatch( states, "%a%a" ) do state_name = frame:expandTemplate{ title = 'US State Abbrev', args = { state } } local dab = if state_name=='New York' or state_name=='Washington' then dab=' (state)' end signatories = signatories .. '\* ' .. frame:expandTemplate{ title = 'flagicon', args = { state_name } } .. ' ' .. state_name .. '' end return signatories end return p |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。