Moodul:Message box/sandbox: erinevus redaktsioonide vahel

Eemaldatud sisu Lisatud sisu
Resümee puudub
Resümee puudub
5. rida:
require('Moodul:No globals')
local getArgs
local categoryHandler = require('Moodul:Category handler')._main
local yesno = require('Moodul:Yesno')
 
14. rida ⟶ 13. rida:
-- Helper functions
--------------------------------------------------------------------------------
 
local function alias(args)
local translateArgs = {
['tüüp'] = 'type',
['pilt'] = 'image',
['piltparemal'] = 'imageright',
['stiil'] = 'style',
['tekstistiil'] = 'textstyle',
['tekst'] = 'text',
['väike'] = 'small',
['väikepilt'] = 'smallimage',
['väikepiltparemal'] = 'smallimageright',
['väiketekst'] = 'smalltext',
['probleem'] = 'issue',
['lahendus'] = 'fix',
['sihitis'] = 'sect',
}
 
for k, v in pairs(translateArgs) do
if args[k] ~= nil then
args[v] = args[k]
end
end
 
return args
end
 
local function getTitleObject(...)
110. rida ⟶ 135. rida:
obj.categories = {}
obj.classes = {}
-- For lazy loading of [[Module:Category handler]].
obj.hasCategories = false
 
return setmetatable(obj, MessageBox)
123. rida ⟶ 150. rida:
cat = string.format('[[Kategooria:%s]]', cat)
end
self.hasCategories = true
self.categories[ns] = self.categories[ns] or {}
table.insert(self.categories[ns], cat)
135. rida ⟶ 163. rida:
 
function MessageBox:setParameters()
local args = alias(self.args)
local cfg = self.cfg
 
288. rida ⟶ 316. rida:
-- Lisasin funktsiooni firstToUpper(), et kuupäeva esimene sõna algaks alati suure tähega
self.date = string.format(" <small>''(%s)''</small>", firstToUpper(date))
-- self.date = string.format(" <small>''(%s)''</small>", date)
end
self.info = args.info
359. rida ⟶ 386. rida:
if mainCat and date and date ~= '' then
local catTitle = string.format('%s %s%s%s', mainCat, '(', date, ')')
self:addCat(20, catTitle)
catTitle = getTitleObject('Kategooria:' .. catTitle)
if not catTitle or not catTitle.exists then
self:addCat(20, 'Mallis vigase kuupäevaparameetriga artiklidaaartiklid')
debug.traceback( date, level )
self:addCat(2, 'Mallis vigase kuupäevaparameetriga artiklidaa')
end
elseif mainCat and (not date or date == '') then
self:addCat(20, mainCat)
end
if allCat then
self:addCat(20, allCat)
end
end
437. rida ⟶ 463. rida:
 
function MessageBox:renderCategories()
if not self.hasCategories then
-- No categories added, no need to pass them to Category handler so,
-- if it was invoked, it would return the empty string.
-- So we shortcut and return the empty string.
return ""
end
-- Convert category tables to strings and pass them through
-- [[Module:Category handler]].
local categoryHandler = return require('Moodul:Category handler')._main{
return categoryHandler{
main = table.concat(self.categories[0] or {}),
template = table.concat(self.categories[10] or {}),
450. rida ⟶ 482. rida:
function MessageBox:export()
local root = mw.html.create()
local frame = mw.getCurrentFrame()
local styles = frame:extensionTag( 'templatestyles', '', { src = 'Moodul:Message box/styles.css' } )
 
-- Stiile mitte laadida mobiilivaates, kus ambox neid ei kasuta.
-- Ei laadita ka teist tüüpi kastide stiile, mida mobiilivaates eirati
-- ka enne TemplateStylesi kasutuselevõttu.
root:wikitext('<div class="nomobile">' .. styles .. '</div>')
 
-- Add the subst check error.
504. rida ⟶ 543. rida:
-- collapsible. At the moment, only ambox uses this.
textCell:cssText(self.textstyle or nil)
local textCellSpantextCellDiv = textCell:tag('spandiv')
-- Muutsin väljade järjestust nii, et date'i sisu jääb peale talk'i (1.11.2016)
textCellDiv
textCellSpan
:addClass('mbox-text-span')
:wikitext(self.issue or nil)
if not self.isSmall then
textCellSpantextCellDiv:tag('span')
:addClass('hide-when-compact')
:wikitext(self.talk and (' ' .. self.talk) or nil)
end
textCellSpantextCellDiv:wikitext(self.date and (' ' .. self.date) or nil)
if not self.isSmall then
textCellSpantextCellDiv:tag('span')
:addClass('hide-when-compact')
:wikitext(self.fix and (' ' .. self.fix) or nil)
end
if not self.isSmall then
textCellDiv
textCellSpan
:tag('span')
:addClass('hide-when-compact')