Module:Routelist row

This is an old revision of this page, as edited by Scott5114 (talk | contribs) at 01:04, 27 February 2013 (halle-frickin-lujah it finally works). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = require("Module:mw")

function p.rowcolor(frame)
    --This function determines if this is a future route, present route, or decommissioned route, and colors the row appropriately.
    
    --Import parameters from template
    local established = frame.args[1]
    local decommissioned = frame.args[2]

--    if 1 == 1 then --lang:FormatDate('Y-m-d') then --this is a future route
--        return "|style=\"background-color:#ffdead;\" title=\"Future route\"|fut|"
--    elseif 
      if decommissioned ~= '0' then --this is a decommissioned route
          return '|- style=\"background-color:#d3d3d3;\" title=\"Former route\"\n'
      else --this is a normal route
          return '|- \n'
      end
end

function p.termini(frame)
    --This function determines if this is a beltway or not, and displays the termini columns appropriately.
    
    --Import parameters from template
    local beltway = frame.args[1]
    local terminus_a = frame.args[2]
    local terminus_b = frame.args[3]

    --The template passes this function the string "0" if {{{beltway}}} is not specified by the template user. 
    if beltway ~= '0' then
        return "|colspan=2 align=center|" .. beltway
    else
       return '|' .. terminus_a .. '||' .. terminus_b
    end
end

return p