"ഘടകം:Shortcut" എന്ന താളിന്റെ പതിപ്പുകൾ തമ്മിലുള്ള വ്യത്യാസം

634 ബൈറ്റുകൾ കൂട്ടിച്ചേർത്തിരിക്കുന്നു ,  27 ജൂൺ
(ചെ.)
ഒരു പതിപ്പ് ഇറക്കുമതി ചെയ്തു
(ചെ.) (ഒരു പതിപ്പ് ഇറക്കുമതി ചെയ്തു)
 
(ചെ.) (ഒരു പതിപ്പ് ഇറക്കുമതി ചെയ്തു)
 
(മറ്റൊരു ഉപയോക്താവ് ചെയ്ത ഇടയ്ക്കുള്ള ഒരു നാൾപ്പതിപ്പ് പ്രദർശിപ്പിക്കുന്നില്ല)
വരി 24: വരി 24:
frame = frame or mw.getCurrentFrame()
frame = frame or mw.getCurrentFrame()
cfg = cfg or mw.loadData(CONFIG_MODULE)
cfg = cfg or mw.loadData(CONFIG_MODULE)
local isCategorized = yesno(options.category) ~= false
local templateMode = options.template and yesno(options.template)
local redirectMode = options.redirect and yesno(options.redirect)
local isCategorized = not options.category or yesno(options.category) ~= false


-- Validate shortcuts
-- Validate shortcuts
വരി 37: വരി 39:
local listItems = {}
local listItems = {}
for i, shortcut in ipairs(shortcuts) do
for i, shortcut in ipairs(shortcuts) do
listItems[i] = string.format('[[%s]]', shortcut)
local templatePath, prefix
if templateMode then
-- Namespace detection
local titleObj = mw.title.new(shortcut, 10)
if titleObj.namespace == 10 then
templatePath = titleObj.fullText
else
templatePath = shortcut
end
prefix = options['pre' .. i] or options.pre or ''
end
if options.target and yesno(options.target) then
listItems[i] = templateMode
and string.format("{{%s[[%s|%s]]}}", prefix, templatePath, shortcut)
or string.format("[[%s]]", shortcut)
else
listItems[i] = frame:expandTemplate{
title = 'No redirect',
args = templateMode and {templatePath, shortcut} or {shortcut, shortcut}
}
if templateMode then
listItems[i] = string.format("{{%s%s}}", prefix, listItems[i])
end
end
end
end
table.insert(listItems, options.msg)
table.insert(listItems, options.msg)
വരി 52: വരി 77:


local root = mw.html.create()
local root = mw.html.create()
 
root:wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Shortcut/styles.css'} })
-- Anchors
-- Anchors
local anchorDiv = root
local anchorDiv = root
:tag('div')
:tag('div')
:css('position', 'relative')
:addClass('module-shortcutanchordiv')
: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
വരി 70: വരി 92:
local nShortcuts = #shortcuts
local nShortcuts = #shortcuts
if nShortcuts > 0 then
if nShortcuts > 0 then
shortcutHeading = message(cfg['shortcut-heading'], nShortcuts)
local headingMsg = options['shortcut-heading'] or
redirectMode and cfg['redirect-heading'] or
cfg['shortcut-heading']
shortcutHeading = message(headingMsg, nShortcuts)
shortcutHeading = frame:preprocess(shortcutHeading)
shortcutHeading = frame:preprocess(shortcutHeading)
shortcutHeading = shortcutHeading .. '\n'
end
end
end
end
വരി 78: വരി 102:
-- Shortcut box
-- Shortcut box
local shortcutList = root
local shortcutList = root
:tag('table')
:tag('div')
:addClass('shortcutbox noprint')
:addClass('module-shortcutboxplain noprint')
:css('float', 'right')
:attr('role', 'note')
:css('border', '1px solid #aaa')
if options.float and options.float:lower() == 'left' then
:css('background', '#fff')
shortcutList:addClass('module-shortcutboxleft')
:css('margin', '.3em .3em .3em 1em')
:css('padding', '3px')
:css('text-align', 'center')
:tag('tr')
:tag('th')
:addClass('plainlist')
:css('border', 'none')
:css('background', 'transparent')
:tag('small')
:wikitext(shortcutHeading)
:tag('ul')
for i, item in ipairs(listItems) do
shortcutList:tag('li'):wikitext(item)
end
end
 
if options.clear and options.clear ~= '' then
-- Output an error category if the first shortcut doesn't exist
shortcutList:css('clear', options.clear)
if isCategorized
end
and shortcuts[1]
if shortcutHeading then
and cfg['first-parameter-error-category']
shortcutList
then
:tag('div')
local title = mw.title.new(shortcuts[1])
:addClass('module-shortcutlist')
if not title or not title.exists then
:wikitext(shortcutHeading)
root:wikitext(makeCategoryLink(cfg['first-parameter-error-category']))
end
end
end
 
local ubl = require('Module:List').unbulleted(listItems)
shortcutList:wikitext(ubl)
return tostring(root)
return tostring(root)
end
end


function p.main(frame)
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
local args = require('Module:Arguments').getArgs(frame)
wrappers = 'Template:Shortcut'
})


-- Separate shortcuts from options
-- Separate shortcuts from options
"https://schoolwiki.in/പ്രത്യേകം:മൊബൈൽവ്യത്യാസം/128840...2507487" എന്ന താളിൽനിന്ന് ശേഖരിച്ചത്