Module:Credits: Difference between revisions

From Videogame Morgue File

mNo edit summary
mNo edit summary
Line 16: Line 16:


     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">' .. sValue .. '</dd>'
       sOutputText = sOutputText .. '<dt class="col-sm-3">' .. iKey .. '</dt><dd class="col-sm-7">'
 
      local split = mw.text.split( sValue, "#")
      for credit in split do
            sOutputText = sOutputText .. credit .. '<br />'
      end
 
      sOutputText = sOutputText .. '</dd>'
 
     end
     end



Revision as of 11:58, 14 Mayıs 2021

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

local p = {};

p.hello = function( frame )
    local str = "Hello World!"
    return str
end

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

    if not( tArgs.args[1] ) then
       tArgs = frame
    end

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

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

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

       sOutputText = sOutputText .. '</dd>'

    end

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

    return sOutputText 
end

return p