Module:Keyword

Module documentation[view][edit][history][purge]
This documentation is transcluded from Module:Keyword/doc. Changes can be proposed in the talk page.
An icon from the Wikimedia Codex library.
Module:Keyword loads configuration from Module:Keyword/config.json.
This module can be configured from the config.json subpage.
Function list
L 5 — p.main
L 10 — p._main

See Template:Keyword for usage instructions.


local getArgs = require('Module:Arguments').getArgs
local p = {}
local root

function p.main(frame)
    local args = getArgs(frame, { parentOnly = true })
    return p._main(args)
end

function p._main(args)
    local config = mw.loadJsonData( 'Module:Keyword/config.json' )

    root = mw.html.create('span')
    root
            :css('color', config[string.lower(args[1])] or 'inherit')
            :wikitext( args[1] )

    return tostring(root)
end

return p