Module:Shortcut: Difference between revisions
use redirect=no
(create replacement for Template:Shortcut) |
(use redirect=no) |
||
Line 29: | Line 29: | ||
local anchorEncode = mw.uri.anchorEncode | local anchorEncode = mw.uri.anchorEncode | ||
local format = string.format | local format = string.format | ||
local fullUrl = mw.uri.fullUrl | |||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
Line 81: | Line 82: | ||
listArgs[#listArgs + 1] = link | listArgs[#listArgs + 1] = link | ||
end | end | ||
listArgs.class = 'plainlinks' | |||
return mList.makeList('bulleted', listArgs) | return mList.makeList('bulleted', listArgs) | ||
end | end | ||
function p.makeShortcutLink(s) | function p.makeShortcutLink(s) | ||
return format('[ | local uriObj = fullUrl(s, {redirect = 'no'}) | ||
local url = tostring(uriObj) | |||
return format('[%s %s]', url, s) | |||
end | end | ||
Line 101: | Line 105: | ||
function p.export(anchors, nShortcuts, shortcutList, errorCategories) | function p.export(anchors, nShortcuts, shortcutList, errorCategories) | ||
local root = mw.html.create('') | local root = mw.html.create('') | ||
root:tag('div') | root | ||
:tag('div') | |||
:css{position = 'relative', top = '-3em'} | |||
:wikitext(anchors) | |||
root | |||
:tag('table') | |||
:addClass('shortcutbox noprint') | |||
:css{ | |||
float = 'right', | |||
border = '1px solid #aaa', | |||
background = '#fff', | |||
margin = '.3em .3em .3em 1em', | |||
padding = '3px', | |||
['text-align'] = 'center' | |||
} | |||
:tag('tr') | |||
:tag('th') | |||
:addClass('plainlist') | |||
:css{border = 'none', background = 'transparent'} | |||
:tag('small') | |||
:wikitext( | |||
nShortcuts <= 1 | |||
and cfg.shortcutHeaderSingular | |||
or cfg.shortcutHeaderPlural | |||
) | |||
:newline() | |||
:wikitext(shortcutList) | |||
root:wikitext(errorCategories) | root:wikitext(errorCategories) | ||
return tostring(root) | return tostring(root) |