Jump to content

Module:Italic title

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 07:52, 17 June 2013 (create a replacement for Template:Italic title). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

local p = {}

function p.main()
    local title = mw.title.getCurrentTitle()
    local prefix, brackets = mw.ustring.match(title.text, '(.+) (%([^%(%)]+%))$')
    local result
    if prefix and brackets then
        result = "''" .. prefix .. "'' " .. brackets
    else
        result = "''" .. title.text .. "''"
    end
    result = '{{DISPLAYTITLE:' .. title.nsText .. result .. '}}'
    return mw.getCurrentFrame:preprocess(result)
end

return p