A modult a Modul:shortcut box/doc lapon tudod dokumentálni
local export = {}
function export.show(frame)
local output = {}
local args = frame:getParent().args
local demo = false
local FULLPAGENAME = mw.title.getCurrentTitle().fullText
local BASEPAGENAME, SUBPAGENAME = FULLPAGENAME:match("^(.-)/(-)$")
-- BASEPAGENAME = BASEPAGENAME or FULLPAGENAME
if FULLPAGENAME == frame:getParent():getTitle() then
demo = true
end
output = '<div class="noprint plainlinks shortcut-box">'
if args.temp then
output = "Temporary and 's' or '') .. "]]:<br/>"
else
output = " and 's' or '') .. "]]:<br/>"
end
local attn = false
for i, shcut in ipairs(args) do
local title = mw.title.new(shcut)
if not title then
output = '<span class="attentionseeking">(<code>' .. mw.text.nowiki(shcut) .. '</code>)</span><br/>'
attn = true
else
local iattn = false
local item = ''
if title.namespace == 10 then
item = '<code>{{}}</code>'
end
if not title.exists then
attn = true
local query = 'action=edit&redlink=1&preloadtext=' .. mw.uri.encode('#REDIRECT ]')
if title.namespace == 10 then
item = '<code>{{}}</code>'
else
item = ''
end
elseif not demo then
local content = title:getContent()
local target = content:match("^#%s*:?%s*%]")
if not target then
iattn = true
else
target = target:gsub("_", " ")
local tns, tpg = target:match("%s*(.-)%s*:%s*(.*)%s*")
if mw.site.namespaces then
tns = mw.site.namespaces.name
target = tns .. ':' .. tpg
end
if title.namespace == 10 then
if SUBPAGENAME == 'documentation' then
iattn = (target ~= BASEPAGENAME)
else
iattn = (target ~= FULLPAGENAME)
end
else
if SUBPAGENAME == 'documentation' then
iattn = (target ~= BASEPAGENAME) and (target ~= FULLPAGENAME)
else
iattn = (target ~= FULLPAGENAME) and (target ~= (FULLPAGENAME .. '/documentation'))
end
end
end
end
if iattn then
item = '<span class="attentionseeking">' .. item .. '</span>'
end
output = item .. '<br/>'
attn = attn or iattn
end
end
if not args.nocat then
if attn then
output = ']'
end
if SUBPAGENAME ~= 'documentation' then
output = ']'
end
end
output = '</div>'
return table.concat(output)
end
return export