Module:Sandbox/Erutuon/Template syntax
Testcases
'"`UNIQ--templatestyles-00000000-QINU`"'<cite id="CITEREFChayka2016" class="citation web cs1">Chayka, Katy (2016). ''MinnesotaWildflowers.info''.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=MinnesotaWildflowers.info&rft.date=2016&rft.aulast=Chayka&rft.aufirst=Katy&rfr_id=info%3Asid%2Fenwiki.freddythechick.net%3AModule%3ASandbox%2FErutuon%2FTemplate+syntax" class="Z3988"></span> <span class="cs1-visible-error citation-comment"><code class="cs1-code">{{[[Template:cite web|cite web]]}}</code>: </span><span class="cs1-visible-error citation-comment">Missing or empty <code class="cs1-code">|title=</code> ([[Help:CS1 errors#citation_missing_title|help]])</span>; <span class="cs1-visible-error citation-comment">Missing or empty <code class="cs1-code">|url=</code> ([[Help:CS1 errors#cite_web_url|help]])</span>[[Category:CS1 errors: missing title|ο]][[Category:CS1 errors: requires URL|ο]]
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