This documentation is transcluded from Module:Indicator/doc. Changes can be proposed in the talk page.
| Module:Indicator loads configuration from Module:Indicator/config.json. This module can be configured from the config.json subpage. |
| Module:Indicator loads styles from Module:Indicator/styles.css. |
local getArgs = require('Module:Arguments').getArgs
local p = {}
function p.main(frame)
local args = getArgs(frame, { parentOnly = true })
return p._main(frame, args)
end
function p._main(frame, args)
local config = mw.loadJsonData( 'Module:Indicator/config.json' )
local namespace = mw.title.getCurrentTitle().namespace
local indicator, image, text, link
if args[1] then
text = string.lower(args[1])
indicator = config.indicators[text]
elseif config.indicators[config.namespaces[namespace]] then
indicator = config.indicators[config.namespaces[namespace]]
else
return
end
image = indicator.image
text = indicator.text
link = indicator.link or text
local html = mw.html.create( nil )
:tag('div')
:addClass('indicator__container')
:tag('div')
:addClass('indicator__image')
:wikitext(string.format("[[File:%s|40px|link=%s]]", image, link))
:done()
:tag('div')
:addClass('indicator__text')
:wikitext(string.format("[[%s|%s]]", link, text))
:done()
:done()
return frame:extensionTag {
name = 'templatestyles', args = { src = "Module:Indicator/styles.css" }
} .. tostring(html)
end
return p