יחידה:Navbox: הבדלים בין גרסאות בדף

מאין תקציר עריכה
מ גרסה אחת של הדף wikipedia:he:יחידה:Navbox יובאה
 
(14 גרסאות ביניים של 4 משתמשים אינן מוצגות)
שורה 20: שורה 20:
-- by parent navboxes. The result is that the category shows all pages
-- by parent navboxes. The result is that the category shows all pages
-- where a child navbox is not contained in a parent navbox.
-- where a child navbox is not contained in a parent navbox.
local orphanCat = '[[Category:Navbox orphans]]'
local orphanCat = '[[קטגוריה:תבניות ניווט יתומות]]'
if border == 'subgroup' and args.orphan ~= 'yes' then
if border == 'subgroup' and args.orphan ~= 'yes' then
-- No change; striping occurs in outermost navbox.
-- No change; striping occurs in outermost navbox.
שורה 81: שורה 81:
local function renderNavBar(titleCell)
local function renderNavBar(titleCell)


if args.navbar ~= 'off' and args.navbar ~= 'plain' and not (not args.name and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', '') == 'Template:Navbox') then
if args.navbar ~= 'off' and args.navbar ~= 'plain' and not (not args.name and mw.getCurrentFrame():getParent():getTitle():gsub('/ארגז חול$', '') == 'תבנית:ניווט') then
titleCell:wikitext(navbar{
titleCell:wikitext(navbar{
args.name,
args.name,
mini = 1,
mini = 1,
fontstyle = (args.basestyle or '') .. ';' .. (args.titlestyle or '') .. ';background:none transparent;border:none;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none; padding:0;'
fontstyle = (args.basestyle or '') .. ';' .. (args.titlestyle or '') .. ';background:none transparent;border:none;box-shadow:none;padding:0;'
})
})
end
end
שורה 115: שורה 115:
if args.titlegroup then
if args.titlegroup then
titleCell
titleCell
:css('border-left', '2px solid #fdfdfd')
:css('border-right', '2px solid #fdfdfd')
:css('width', '100%')
:css('width', '100%')
end
end
שורה 192: שורה 192:
row
row
:tag('td')
:tag('td')
:addClass('noviewer')
:addClass('navbox-image')
:addClass('navbox-image')
:addClass(args.imageclass)
:addClass(args.imageclass)
שורה 229: שורה 230:
listCell
listCell
:css('text-align', 'left')
:css('text-align', 'left')
:css('border-left-width', '2px')
:css('border-right-width', '2px')
:css('border-left-style', 'solid')
:css('border-right-style', 'solid')
else
else
listCell:attr('colspan', 2)
listCell:attr('colspan', 2)
שורה 268: שורה 269:
row
row
:tag('td')
:tag('td')
:addClass('noviewer')
:addClass('navbox-image')
:addClass('navbox-image')
:addClass(args.imageclass)
:addClass(args.imageclass)
שורה 323: שורה 325:
end
end
return false
return false
end
local function getTrackingCategories()
local cats = {}
--[[
if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end
if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end
if isIllegible() then table.insert(cats, 'Potentially illegible navboxes') end
if hasBorders() then table.insert(cats, 'Navboxes using borders') end
]]
return cats
end
local function renderTrackingCategories(builder)
local title = mw.title.getCurrentTitle()
if title.namespace ~= 10 then return end -- not in template space
local subpage = title.subpageText
if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end
for _, cat in ipairs(getTrackingCategories()) do
builder:wikitext('[[Category:' .. cat .. ']]')
end
end
end


שורה 356: שורה 336:


if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
if args.state == 'collapsed' then args.state = 'mw-collapsed' end
tbl
tbl
:addClass('collapsible')
:addClass('mw-collapsible')
:addClass(args.state or 'autocollapse')
:addClass(args.state or 'autocollapse')
end
end
שורה 429: שורה 410:
:attr('role', 'navigation')
:attr('role', 'navigation')
:addClass('navbox')
:addClass('navbox')
:addClass(args.navboxclass)
:cssText(args.bodystyle)
:cssText(args.bodystyle)
:cssText(args.style)
:cssText(args.style)
שורה 441: שורה 423:
end
end


if (args.nocat or 'false'):lower() == 'false' then
renderTrackingCategories(res)
end
return striped(tostring(res))
return striped(tostring(res))
end
end
שורה 451: שורה 430:
getArgs = require('Module:Arguments').getArgs
getArgs = require('Module:Arguments').getArgs
end
end
args = getArgs(frame, {wrappers = {'Template:Navbox', 'Template:Navbox subgroup'}})
args = getArgs(frame)
if frame.args.border then
 
-- This allows Template:Navbox_subgroup to use {{#invoke:Navbox|navbox|border=...}}.
-- Translate ordinal Hebrew letters
args.border = frame.args.border
local translatedArgs = {};
for k,v in pairs(args) do
if mw.ustring.match(k, '[א-ת]') ~=nil then
local enKey = mw.ustring.gsub( k, 'שם', 'name' )
enKey = mw.ustring.gsub( enKey, 'הסתרה', 'state' )
enKey = mw.ustring.gsub( enKey, 'קישורים', 'navbar' )
enKey = mw.ustring.gsub( enKey, 'גבול', 'border' )
enKey = mw.ustring.gsub( enKey, 'סגנון תוכן', 'bodystyle' )
enKey = mw.ustring.gsub( enKey, 'סגנון בסיסי', 'basestyle' )
enKey = mw.ustring.gsub( enKey, 'סגנון כותרת', 'titlestyle' )
enKey = mw.ustring.gsub( enKey, 'סגנון קבוצה', 'groupstyle' )
enKey = mw.ustring.gsub( enKey, 'רוחב קבוצה', 'groupwidth' )
enKey = mw.ustring.gsub( enKey, 'סגנון רשימה', 'liststyle' )
enKey = mw.ustring.gsub( enKey, 'ריפוד רשימה', 'listpadding' )
enKey = mw.ustring.gsub( enKey, 'סגנון אי זוגי', 'oddstyle' )
enKey = mw.ustring.gsub( enKey, 'סגנון זוגי', 'evenstyle' )
enKey = mw.ustring.gsub( enKey, 'זוגי ואי זוגי', 'evenodd' )
enKey = mw.ustring.gsub( enKey, 'סגנון תמונה משמאל', 'imageleftstyle' )
enKey = mw.ustring.gsub( enKey, 'סגנון תמונה', 'imagestyle' )
enKey = mw.ustring.gsub( enKey, 'סגנון למעלה', 'abovestyle' )
enKey = mw.ustring.gsub( enKey, 'סגנון למטה', 'belowstyle' )
enKey = mw.ustring.gsub( enKey, 'מחלקה תבנית', 'navboxclass' )
enKey = mw.ustring.gsub( enKey, 'מחלקה תוכן', 'bodyclass' )
enKey = mw.ustring.gsub( enKey, 'מחלקה כותרת', 'titleclass' )
enKey = mw.ustring.gsub( enKey, 'מחלקה קבוצה', 'groupclass' )
enKey = mw.ustring.gsub( enKey, 'מחלקה רשימה', 'listclass' )
enKey = mw.ustring.gsub( enKey, 'מחלקה למעלה', 'aboveclass' )
enKey = mw.ustring.gsub( enKey, 'מחלקה למטה', 'belowclass' )
enKey = mw.ustring.gsub( enKey, 'מחלקה תמונה', 'imageclass' )
enKey = mw.ustring.gsub( enKey, 'סגנון קבוצה בכותרת', 'titlegroupstyle' )
enKey = mw.ustring.gsub( enKey, 'מחלקה קבוצה בכותרת', 'titlegroupclass' )
enKey = mw.ustring.gsub( enKey, 'קבוצה בכותרת', 'titlegroup' )
enKey = mw.ustring.gsub( enKey, 'סגנון פנימי', 'innerstyle' )
enKey = mw.ustring.gsub( enKey, 'לא לעטוף', 'nowrapitems' )
enKey = mw.ustring.gsub( enKey, 'יתום', 'orphan' )
enKey = mw.ustring.gsub( enKey, 'כותרת', 'title' )
enKey = mw.ustring.gsub( enKey, 'קבוצה', 'group' )
enKey = mw.ustring.gsub( enKey, 'רשימה', 'list' )
enKey = mw.ustring.gsub( enKey, 'סגנון', 'style' )
enKey = mw.ustring.gsub( enKey, 'תמונה משמאל', 'imageleft' )
enKey = mw.ustring.gsub( enKey, 'תמונה', 'image' )
enKey = mw.ustring.gsub( enKey, 'למעלה', 'above' )
enKey = mw.ustring.gsub( enKey, 'למטה', 'below' )
 
translatedArgs[enKey] = v
else
translatedArgs[k] = v
end
end
local paramOptions = {
["state"] = {
["אוטומטי"] = "autocollapse",
["מוסתר"] = "collapsed",
["מורחב"] = "expanded",
["פשוט"] = "plain",
["ללא"] = "off"
},
["navbar"] = {
["פשוט"] = "plain",
["ללא"] = "off"
},
["border"] = {
["צאצא"] = "child",
["תת קבוצה"] = "subgroup",
["ללא"] = "none"
},
["evenodd"] = {
["הפוך"] = "swap",
["זוגי"] = "even",
["אי זוגי"] = "odd",
["ללא"] = "off"
},
["nowrapitems"] = {
["כן"] = "yes"
},
["orphan"] = {
["כן"] = "yes"
}
}
for k,v in pairs(paramOptions) do
for hebrewValue,englishValue in pairs(v) do
if translatedArgs[k] == hebrewValue then
translatedArgs[k] = englishValue
end
end
end
end


-- Read the arguments in the order they'll be output in, to make references number in the right order.
-- Read the arguments in the order they'll be output in, to make references number in the right order.
local _
local _
_ = args.title
_ = translatedArgs.title
_ = args.above
_ = translatedArgs.above
for i = 1, 20 do
for i = 1, 20 do
_ = args["group" .. tostring(i)]
_ = translatedArgs["group" .. tostring(i)]
_ = args["list" .. tostring(i)]
_ = translatedArgs["list" .. tostring(i)]
end
end
_ = args.below
_ = translatedArgs.below


return p._navbox(args)
return p._navbox(translatedArgs)
end
end


return p
return p