![]() |
VOOZH | about |
p.unsigned implements {{unsigned}} and {{undated}}.
p.unsigned only)localp={} localfunctionbase(args) localtype=args.typeor'Unsigned' localuser=args.user localdate=args.date ifdatethen date=mw.getContentLanguage():formatDate("H\\:i\\, j F Y \\(e\\)",date,true) end localnowiki='' ifmw.isSubsting()then nowiki='<nowiki/>' end localtext={ '<small class="'..string.lower(type)..'-template">– '..type..' comment added', '. Please sign comments with ~~'..nowiki..'~~</small>' } ifdatethen table.insert(text,2,' at '..date) end ifuserthen localuserLinks ifnotuser:find('[^:%x%.%d]')andrequire('Module:IPAddress').isIP(user)then userLinks='[[Special:Contribs/'..user..'|'..user..']] ([[User talk:'..user..'|talk]])' else userLinks='[[User:'..user..'|'..user..']] ([[User talk:'..user..'|talk]] • [[Special:Contribs/'..user..'|contribs]])' end table.insert(text,2,' by '..userLinks) end returntable.concat(text) end p.unsigned=function(f) localargs=require('Module:ProcessArgs').norm(f.argsorf) localtype=args.typeor'Unsigned' localuser=args.user localdate=args.date localcategory={'<!-- Template:'..type..' -->'} ifmw.isSubsting()then -- Don't allow substitution with missing required arg iftype=='Unsigned'andnotuserthen localdateArg='' ifdatethen dateArg='||'..date end return'{{Unsigned'..dateArg..'}}' elseiftype=='Undated'andnotdatethen return'{{Undated}}' end elseifmw.title:getCurrentTitle().namespace~=10then iftype=='Unsigned'andnotuserthen table.insert(category,'[[Category:Unsigned template used incorrectly]]') elseiftype=='Undated'andnotdatethen table.insert(category,'[[Category:Undated template used incorrectly]]') end table.insert(category,'[[Category:Pages with templates requiring substitution]]') end returnbase(args)..table.concat(category) end returnp