Module:Shortcut: Difference between revisions

use redirect=no
Enwikipedia>Mr. Stradivarius
(create replacement for Template:Shortcut)
 
Enwikipedia>Mr. Stradivarius
(use redirect=no)
Line 29:
local anchorEncode = mw.uri.anchorEncode
local format = string.format
local fullUrl = mw.uri.fullUrl
 
--------------------------------------------------------------------------------
Line 81 ⟶ 82:
listArgs[#listArgs + 1] = link
end
listArgs.class = 'plainlinks'
return mList.makeList('bulleted', listArgs)
end
 
function p.makeShortcutLink(s)
local uriObj = fullUrl(s, {redirect = 'no'})
return format('[[%s]]', s)
local url = tostring(uriObj)
return format('[[%s] %s]', url, s)
end
 
Line 101 ⟶ 105:
function p.export(anchors, nShortcuts, shortcutList, errorCategories)
local root = mw.html.create('')
root:tag('div')
:tag('trdiv')
:css{position = 'relative', top = '-3em'}
:wikitext(anchors)
:donewikitext(anchors)
root
:tag('table')
:addClasstag('shortcutbox noprinttable')
:addClass('shortcutbox noprint')
:css{
float = 'right',
border float = '1px solid #aaaright',
background border = '1px solid #fffaaa',
margin background = '.3em .3em .3em 1em#fff',
padding margin = '3px.3em .3em .3em 1em',
['text-align'] padding = 'center3px',
['text-align'] = 'center'
}
:tag('tr')
:tag('thtr')
:addClasstag('plainlistth')
:addClass('plainlist')
:css{border = 'none', background = 'transparent'}
:tag('small')
:wikitexttag('small')
nShortcuts <= 1 :wikitext(
nShortcuts <= 1
and cfg.shortcutHeaderSingular
or and cfg.shortcutHeaderPluralshortcutHeaderSingular
or cfg.shortcutHeaderPlural
)
:newline( )
:wikitextnewline(shortcutList)
:wikitext(anchorsshortcutList)
root:wikitext(errorCategories)
return tostring(root)