Editing Module:Shortcut

From Guild of Archivists
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 55: Line 55:


local root = mw.html.create()
local root = mw.html.create()
root:wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Shortcut/styles.css'} })
 
-- Anchors
-- Anchors
local anchorDiv = root
local anchorDiv = root
:tag('div')
:tag('div')
:addClass('module-shortcutanchordiv')
:css('position', 'relative')
:css('top', '-3em')
for i, shortcut in ipairs(shortcuts) do
for i, shortcut in ipairs(shortcuts) do
local anchor = mw.uri.anchorEncode(shortcut)
local anchor = mw.uri.anchorEncode(shortcut)
anchorDiv:tag('span'):attr('id', anchor)
anchorDiv:tag('span'):attr('id', anchor)
end
end
root:newline() -- To match the old [[Template:Shortcut]]


-- Shortcut heading
-- Shortcut heading
Line 72: Line 75:
shortcutHeading = message(cfg['shortcut-heading'], nShortcuts)
shortcutHeading = message(cfg['shortcut-heading'], nShortcuts)
shortcutHeading = frame:preprocess(shortcutHeading)
shortcutHeading = frame:preprocess(shortcutHeading)
shortcutHeading = shortcutHeading .. '\n'
end
end
end
end
Line 78: Line 82:
local shortcutList = root
local shortcutList = root
:tag('div')
:tag('div')
:addClass('module-shortcutboxplain plainlist noprint')
:addClass('shortcutbox plainlist noprint')
:attr('role', 'note')
:attr('role', 'note')
:css('float', 'right')
:css('border', '1px solid #aaa')
:css('background', '#fff')
:css('margin', '0em 0em 0em 1em')
:css('padding', '.3em .6em .2em .6em')
:css('text-align', 'center')
:css('font-size', '85%')
:css('font-weight', 'bold')
if shortcutHeading then
if shortcutHeading then
shortcutList
shortcutList
:tag('div')
:tag('div')
:addClass('module-shortcutlist')
:css('display','inline-block')
:css('border-bottom','1px solid #aaa')
:css('margin-bottom', '.2em')
:css('font-weight', 'normal')
:wikitext(shortcutHeading)
:wikitext(shortcutHeading)
end
end
local list = shortcutList:tag('ul')
shortcutList
:tag('ul')
for i, item in ipairs(listItems) do
for i, item in ipairs(listItems) do
list:tag('li'):wikitext(item)
shortcutList:tag('li'):wikitext(item)
end
end
return tostring(root)
return tostring(root)
end
end
Please note that all contributions to Guild of Archivists may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see GoArch:Copyrights for details). Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)

Templates used on this page: