Difference between revisions of "Module:Sandbox/Ahecht/trim date"

From blackwiki
Jump to navigation Jump to search
blackwiki>Ahecht
m (Ahecht moved page Module:Sandbox/ahecht/trim date to Module:Sandbox/Ahecht/trim date without leaving a redirect: Caps)
m (30 revisions imported)
 
(No difference)

Latest revision as of 09:15, 27 September 2020

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