Module:Credits: Difference between revisions

From Videogame Morgue File

mNo edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
local p = {};
local p = {};
p.hello = function( frame )
    local str = "Hello World!"
    return str
end


function p.credits( frame )
function p.credits( frame )
     local tArgs = frame:getParent()
     local tArgs = frame:getParent()


    if not( tArgs.args[1] ) then
--    if not( tArgs.args[1] ) then
      tArgs = frame
--      tArgs = frame
    end
--      return "args came from frame"
--    end


     local sOutputText = '<div class="container-fluid"><dl class="row">'
     local sOutputText = '<div class="container-fluid"><dl class="row">'
-- TODO these come out in every which order


     for iKey,sValue in pairs(tArgs.args) do  
     for iKey,sValue in pairs(tArgs.args) do  
       sOutputText = sOutputText .. '<dt class="col-sm-3">' .. iKey .. '</dt><dd class="col-sm-7">'
       sOutputText = sOutputText .. '<dt class="col-sm-3">' .. iKey .. '</dt><dd class="col-sm-7">'


       local split = mw.text.split( sValue, "#")
       local credits_table = mw.text.split( sValue, "#")
       for credit in split do
       credits_string = table.concat( credits_table, '<br />' )
            sOutputText = sOutputText .. credit .. '<br />'
      end


       sOutputText = sOutputText .. '</dd>'
       sOutputText = sOutputText .. credits_string .. '</dd>'


     end
     end
Line 30: Line 27:


     return sOutputText  
     return sOutputText  
end
function p.creditline( frame )
  local tArgs = frame:getParent()
  local sOutputText = ''
  for iKey,sValue in pairs(tArgs.args) do
    sOutputText = sOutputText .. '<dt class="col-sm-3">' .. iKey .. '</dt><dd class="col-sm-7">'
    local credits_table = mw.text.split( sValue, "#")
    credits_string = table.concat( credits_table, '<br />' )
    sOutputText = sOutputText .. credits_string .. '</dd>'
  end
  return sOutputText
end
end


return p
return p

Latest revision as of 16:44, 20 Mayıs 2021

Documentation for this module may be created at Module:Credits/doc

local p = {};

function p.credits( frame )
    local tArgs = frame:getParent()

--    if not( tArgs.args[1] ) then
--       tArgs = frame
--      return "args came from frame"
--    end

    local sOutputText = '<div class="container-fluid"><dl class="row">'

-- TODO these come out in every which order

    for iKey,sValue in pairs(tArgs.args) do 

       sOutputText = sOutputText .. '<dt class="col-sm-3">' .. iKey .. '</dt><dd class="col-sm-7">'

       local credits_table = mw.text.split( sValue, "#")
       credits_string = table.concat( credits_table, '<br />' )

       sOutputText = sOutputText .. credits_string .. '</dd>'

    end

    sOutputText = sOutputText .. "</dl></div>"

    return sOutputText 
end

function p.creditline( frame )
  local tArgs = frame:getParent()

  local sOutputText = ''

  for iKey,sValue in pairs(tArgs.args) do 

     sOutputText = sOutputText .. '<dt class="col-sm-3">' .. iKey .. '</dt><dd class="col-sm-7">'

     local credits_table = mw.text.split( sValue, "#")
     credits_string = table.concat( credits_table, '<br />' )

     sOutputText = sOutputText .. credits_string .. '</dd>'

  end

  return sOutputText
end

return p