Changes

Module:Documentation

226 bytes added, 09:53, 31 January 2014
make [create] links look like [view] [edit] etc. links
-- @data - a table of data generated by p.makeStartBoxLinksData
--]]
local function escapeBrackets(s)
-- Escapes square brackets with HTML entities.
s = s:gsub('%[', '[') -- Replace square brackets with HTML entities.
s = s:gsub('%]', ']')
return s
end
 
local ret
local docTitle = data.docTitle
local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay)
ret = '[%s] [%s] [%s] [%s]'
ret = ret:gsubescapeBrackets('%[', '[') -- Replace square brackets with HTML entities. ret = ret:gsub('%]', ']')
ret = mw.ustring.format(ret, viewLink, editLink, historyLink, purgeLink)
else
ret local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay) ret = '[%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink)
end
return ret
-- 'file-namespace-heading' --> 'Summary'
-- 'other-namespaces-heading' --> 'Documentation'
-- 'start-box-linkclasses' --> 'mw-editsection -like plainlinks'
-- 'start-box-link-id' --> 'doc_editlinks'
-- 'testcases-create-link-display' --> 'create'
Anonymous user