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

From blackwiki
Jump to navigation Jump to search
blackwiki>Ahecht
(debug)
blackwiki>Ahecht
(debug)
Line 5: Line 5:
 
if date == nil then date = frame.args[1] end
 
if date == nil then date = frame.args[1] end
 
if date == nil then date = "123" end
 
if date == nil then date = "123" end
date2 = string.gsub( date, "<.-mw%-formatted%-date.->", "")
+
date2 = string.gsub( date, "&lt;.-mw%-formatted%-date.-%gt;", "")
date3 = string.gsub( date2, "<.-nowiki.->", "")
+
date3 = string.gsub( date2, "&lt;.-nowiki.-%gt;", "")
date4 = string.gsub( date3, "<.*>", "")
+
date4 = string.gsub( date3, "&lt;.*%gt;", "")
return date
+
return date4
 
end
 
end
  
 
return p
 
return p

Revision as of 15:13, 25 April 2017

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
	date2 = string.gsub( date, "&lt;.-mw%-formatted%-date.-%gt;", "")
	date3 = string.gsub( date2, "&lt;.-nowiki.-%gt;", "")
	date4 = string.gsub( date3, "&lt;.*%gt;", "")
	return date4
end

return p