Module:Sandbox/Ahecht/trim date

< Module:Sandbox‎ | Ahecht
Revision as of 16:35, 13 February 2018 by imported>Ahecht (Ahecht moved page Module:Sandbox/ahecht/trim date to Module:Sandbox/Ahecht/trim date without leaving a redirect: Caps)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Sandbox/Ahecht/trim date/doc

local p = {}

function p.trim(frame)
	local date = frame:getParent().args[1]
	if date == nil then date = frame.args[1] end
	if date == nil then date = "123" end
	date = string.gsub( date, "%lt;", "<" )
	date = string.gsub( date, "%gt;", ">" )
	date = string.gsub( date, "\'\"`", "<" )
	date = string.gsub( date, "\`\"'", ">" )
	date = string.gsub( date, "<.-mw%-formatted%-date.->", "" )
	date = string.gsub( date, "<.-nowiki.->", "" )
	date = string.gsub( date, "<.*>", "" )
	return date
end

return p