Module:Version History
Jump to navigation
Jump to search
Documentation The documentation below is transcluded from Module:Version History/doc. (edit | history)
This module provides the functionality of {{vh}}
.
local p = {}
local THRESHOLD = 10
function p.main(frame)
local _, countLines = string.gsub("\n" .. frame.args[1], "\n%*", "")
local containerClasses = "terraria history-collapsible plaincollapse mw-collapsible"
if countLines > THRESHOLD then
containerClasses = containerClasses .. " mw-collapsed"
end
local container = mw.html.create("table"):attr({
["class"] = containerClasses,
["width"] = "100%",
["data-expandtext"] = "Click here to reveal",
["data-collapsetext"] = "Hide"
})
container:tag("tr")
:tag("th"):css("font-weight", "unset")
:tag("span"):css("float", "right"):wikitext(("[[[History:%s|Edit]]]"):format(mw.title.getCurrentTitle().text))
container:tag("tr")
:tag("td")
:tag("i"):wikitext("These history sections are still a [[Calamity Mod Wiki:Version history|work-in-progress]], and may not yet contain changes relevant to the current version of the Calamity Mod."):done()
:wikitext(frame.args[1]) -- passing the already expanded text as a parameter to save time and processing power
return tostring(container)
end
return p