Module:TemplateStructure: Difference between revisions

No edit summary
Tag: Reverted
Undo revision 1359365 by MarkWD (talk)
Tag: Undo
Line 30: Line 30:
     local blocks = config.blocks or {}
     local blocks = config.blocks or {}


    -- Begin the table markup.
     local result = {}
     local result = {}
    -- Header includes a trailing newline.
     table.insert(result, string.format('{| class="%s" %s', tableClass, tableAttrs))
     table.insert(result, string.format('{| class="%s" %s\n', tableClass, tableAttrs))
      
      
    -- Process each block function in the supplied order.
     for i, block in ipairs(blocks) do
     for i, block in ipairs(blocks) do
         if type(block) == "function" then
         if type(block) == "function" then
Line 46: Line 47:
     end
     end
      
      
    -- Footer prepended with a newline to ensure proper formatting.
     table.insert(result, "|}")
     table.insert(result, "\n|}")
      
      
     local finalOutput = table.concat(result, "")
     local finalOutput = table.concat(result, "\n")
     return trim(finalOutput)
     return trim(finalOutput)
end
end


return p
return p