Module:Purge
Jump to navigation
Jump to search
Module documentation
This documentation is transcluded from Module:Purge/doc. [edit] [history] [purge]
Module:Purge is required by Module:Products.
Provides a purge link. Can be customised if used by lua, or lesser customisation via Template:Purge.
This module is a helper module to be used by other modules; it may not designed to be invoked directly. See Brighter Shores:Lua/Helper modules for a full list and more information. For a full list of modules using this helper click here
Function | Type | Use |
---|---|---|
_purge( anchor, text, tag, noinplace ) | string/table, string, string, boolean | Generates a purge link
All args are optional.
|
local purge = require( 'Module:Purge' )._purge
local refreshLink = purge( nil, 'refresh' )
-- Or
local refreshLink = purge{ text = 'refresh' }
-- <nowiki>
-- Implements Template:Purge
--
local p = {}
function p._purge(anchor, text, tag, noinplace)
if type( anchor ) == 'table' then -- Allow function to be called with named argruments
text = anchor.text
tag = anchor.tag
noinplace = anchor.noinplace
anchor = anchor.anchor
end
local page_title = mw.title.getCurrentTitle().fullText
local link = string.format('[%s#%s %s]',tostring(mw.uri.fullUrl(page_title,'action=purge')),anchor or 'res', text or '(wrong?)')
link = string.format('<%s class="plainlinks%s" id="res" title="If this information seems incorrect, click here to force an update.">%s</%s>',
tag or 'sup', (noinplace and '') or ' jsPurgeLink', link, tag or 'sup')
return link
end
function p.purge(frame)
return p._purge(frame:getParent().args.anchor)
end
return p