Module:Sandbox/Erutuon/Template syntax
Jump to navigation
Jump to search
File:Test Template Info-Icon - Version (2).svg Module documentation[view] [edit] [history] [purge]
Testcases
[edit source]<strong class="error"><span class="scribunto-error mw-scribunto-error-9a1b0f74">Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).</span></strong>
f = {}
function f.format(frame)
template = frame.args[1]
language = mw.language.new("en")
date = language:formatDate("j F Y")
template = mw.text.nowiki(template)
local accessdate = string.find(template, "access%-?date ?= ?")
if accessdate ~= nil then
local datePosition = accessdate[2]
local beforeDate = string.sub(template, 1, datePosition)
local afterDate = string.sub(template, datePosition + 1, -1)
end
if beforeDate and afterDate then
return beforeDate .. date .. afterDate
else
return template
end
end
return f