Module:Shortcut: Difference between revisions
Content added Content deleted
Enwikipedia>Mr. Stradivarius (create replacement for Template:Shortcut) |
Enwikipedia>Mr. Stradivarius (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) |
||
local uriObj = fullUrl(s, {redirect = 'no'}) |
|||
⚫ | |||
local url = tostring(uriObj) |
|||
⚫ | |||
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 |
root |
||
⚫ | |||
:css{position = 'relative', top = '-3em'} |
:css{position = 'relative', top = '-3em'} |
||
⚫ | |||
: |
:wikitext(anchors) |
||
root |
|||
:tag('table') |
|||
: |
:tag('table') |
||
:addClass('shortcutbox noprint') |
|||
:css{ |
:css{ |
||
float = 'right', |
|||
float = 'right', |
|||
border = '1px solid #aaa', |
|||
background = '#fff', |
|||
margin = '.3em .3em .3em 1em', |
|||
padding = '3px', |
|||
['text-align'] = 'center' |
|||
} |
} |
||
⚫ | |||
:tag(' |
:tag('tr') |
||
: |
:tag('th') |
||
:addClass('plainlist') |
|||
:css{border = 'none', background = 'transparent'} |
:css{border = 'none', background = 'transparent'} |
||
:tag('small') |
|||
: |
:tag('small') |
||
:wikitext( |
|||
nShortcuts <= 1 |
|||
and cfg.shortcutHeaderSingular |
|||
and cfg.shortcutHeaderSingular |
|||
or cfg.shortcutHeaderPlural |
|||
) |
|||
) |
|||
: |
:newline() |
||
⚫ | |||
root:wikitext(errorCategories) |
root:wikitext(errorCategories) |
||
return tostring(root) |
return tostring(root) |