Module:Subject page header
Appearance
| This module is used in system messages. Changes to it can cause immediate changes to the Festipedia user interface. To avoid large-scale disruption, any changes should first be tested in this module's /sandbox or /testcases subpage, or in your own user space. The tested changes can then be added in one single edit to this module. Please discuss any changes on the talk page before implementing them. |
This module is used from the interface message MediaWiki:Subjectpageheader, shown at the top of all non-talk pages.
Usage
[edit]{{#invoke:Subject page header|main}}
local p = {}
p.main = function(frame)
local title = mw.title.getCurrentTitle()
-- Bail out quickly on main namespace
if title.namespace == 0 then
return ''
end
local pageName = title.fullText
-- Optimization: first check page name suffix before looking up content model
local isJsonPage = pageName:len() > 5 and pageName:sub(-5) == ".json" and title.contentModel == 'json'
if isJsonPage then
local Hatnote = require('Module:Hatnote')
local docPageName = pageName .. '/doc'
local docTitle = mw.title.new(docPageName)
local content = ''
if docTitle.exists then
content =
'<hr>' ..
Hatnote._hatnote(
'The following documentation is located at [['..docPageName..']].<span class="mw-editsection-like plainlinks">[ [[Special:EditPage/'..docPageName..'|edit]] ] [ [[Special:PageHistory/'..docPageName..'|history]] ]</span>'
) ..
frame:preprocess(docTitle.content)
else
content = Hatnote._hatnote('Documentation for this JSON page can be created at the [['..docPageName..'|/doc]] subpage.')
end
return '<div class="mw-parser-output">' .. content .. '</div>'
end
return ''
end
return p