Module:Changelog

From Industrial-Craft-Wiki
Jump to navigation Jump to search
Template-info.png Documentation

Replacement Lua scripting to do what Template:Changelog does/did, but in a more flexible way.

  • It can have as many changes as needed, providing that they go up sequencially, and numbers are not missed out (change1, change2, change3 is ok, but change1, change3 isn't).
  • It looks simpler. In some ways.
  • It should be faster.

Message me (Chocohead) either on the wiki (here) or on the Forum if you find any problems.

The above documentation is transcluded from Module:Changelog/doc. (edit | history)


local p = {}

-- Generate list
function p.list( args )
   local s = nil
   local n = 1
   local back = "<ul>"

   repeat s = args["change" .. n]
      if s ~= nil then
         back = back .. "<li>" .. s .. "</li>"
         n = n + 1
      end
   until s == nil

   return back .. "</ul><br/><br/>"
end

function p.changes( f )
   if f == mw.getCurrentFrame() then
       args = f:getParent().args
   end
   if args["version"] == nil then
      args["version"] = ""
   end
   if args["IC²"] ~= nil then
      back = "<h2> v" .. args["version"] .. " (IC²) </h2>"
   else
      back = "<h2> v" .. args["version"] .. "</h2>"
   end

   return back .. p.list(args)
end

return p