https://it.seminaverbi.bibleget.io/w/index.php?title=Modulo:Navbox&feed=atom&action=history
Modulo:Navbox - Cronologia
2024-03-28T13:09:18Z
Cronologia della pagina su questo sito
MediaWiki 1.41.0
https://it.seminaverbi.bibleget.io/w/index.php?title=Modulo:Navbox&diff=3999&oldid=prev
Johnrdorazio: una versione importata
2022-10-26T15:19:44Z
<p>una versione importata</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="it">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Versione meno recente</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Versione delle 15:19, 26 ott 2022</td>
</tr><tr><td colspan="2" class="diff-notice" lang="it"><div class="mw-diff-empty">(Nessuna differenza)</div>
</td></tr></table>
Johnrdorazio
https://it.seminaverbi.bibleget.io/w/index.php?title=Modulo:Navbox&diff=3915&oldid=prev
Johnrdorazio: una versione importata
2022-10-25T15:50:19Z
<p>una versione importata</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="it">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Versione meno recente</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Versione delle 15:50, 25 ott 2022</td>
</tr><tr><td colspan="2" class="diff-notice" lang="it"><div class="mw-diff-empty">(Nessuna differenza)</div>
</td></tr></table>
Johnrdorazio
https://it.seminaverbi.bibleget.io/w/index.php?title=Modulo:Navbox&diff=3914&oldid=prev
it>Sakretsu: modulo no globals obsoleto
2022-10-22T19:26:01Z
<p>modulo no globals obsoleto</p>
<a href="https://it.seminaverbi.bibleget.io/w/index.php?title=Modulo:Navbox&diff=3914&oldid=3998">Mostra modifiche</a>
it>Sakretsu
https://it.seminaverbi.bibleget.io/w/index.php?title=Modulo:Navbox&diff=3998&oldid=prev
it>Izno: remove titlegroup per templatestyles section on talk page
2022-01-07T21:39:23Z
<p>remove titlegroup per templatestyles section on talk page</p>
<a href="https://it.seminaverbi.bibleget.io/w/index.php?title=Modulo:Navbox&diff=3998&oldid=1671">Mostra modifiche</a>
it>Izno
https://it.seminaverbi.bibleget.io/w/index.php?title=Modulo:Navbox&diff=1671&oldid=prev
Johnrdorazio: una versione importata
2020-08-29T22:45:43Z
<p>una versione importata</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="it">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Versione meno recente</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Versione delle 22:45, 29 ago 2020</td>
</tr><tr><td colspan="2" class="diff-notice" lang="it"><div class="mw-diff-empty">(Nessuna differenza)</div>
</td></tr></table>
Johnrdorazio
https://it.seminaverbi.bibleget.io/w/index.php?title=Modulo:Navbox&diff=422&oldid=prev
Johnrdorazio: una versione importata
2020-08-28T15:05:05Z
<p>una versione importata</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<tr class="diff-title" lang="it">
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Versione meno recente</td>
<td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Versione delle 15:05, 28 ago 2020</td>
</tr><tr><td colspan="2" class="diff-notice" lang="it"><div class="mw-diff-empty">(Nessuna differenza)</div>
</td></tr></table>
Johnrdorazio
https://it.seminaverbi.bibleget.io/w/index.php?title=Modulo:Navbox&diff=421&oldid=prev
it>Sakretsu: nowrap gestito dal css del modulo, vedi Speciale:Permalink/111974644#Formattazione
2020-04-06T14:35:54Z
<p>nowrap gestito dal css del modulo, vedi <a href="/wiki/Speciale:LinkPermanente/111974644#Formattazione" title="Speciale:LinkPermanente/111974644">Speciale:Permalink/111974644#Formattazione</a></p>
<a href="https://it.seminaverbi.bibleget.io/w/index.php?title=Modulo:Navbox&diff=421&oldid=1670">Mostra modifiche</a>
it>Sakretsu
https://it.seminaverbi.bibleget.io/w/index.php?title=Modulo:Navbox&diff=1670&oldid=prev
it>MusikAnimal: Undid revision 948472523 by w>MusikAnimal (talk)
2020-04-01T06:29:21Z
<p>Undid revision 948472523 by [[Special:Contributions/w>MusikAnimal|w>MusikAnimal]] ([[User talk:w>MusikAnimal|talk]])</p>
<p><b>Nuova pagina</b></p><div>--<br />
-- This module implements {{Navbox}}<br />
--<br />
<br />
local p = {}<br />
<br />
local navbar = require('Module:Navbar')._navbar<br />
local getArgs -- lazily initialized<br />
<br />
local args<br />
local border<br />
local listnums<br />
local ODD_EVEN_MARKER = '\127_ODDEVEN_\127'<br />
local RESTART_MARKER = '\127_ODDEVEN0_\127'<br />
local REGEX_MARKER = '\127_ODDEVEN(%d?)_\127'<br />
<br />
local function striped(wikitext)<br />
-- Return wikitext with markers replaced for odd/even striping.<br />
-- Child (subgroup) navboxes are flagged with a category that is removed<br />
-- by parent navboxes. The result is that the category shows all pages<br />
-- where a child navbox is not contained in a parent navbox.<br />
local orphanCat = '[[Category:Navbox orphans]]'<br />
if border == 'subgroup' and args.orphan ~= 'yes' then<br />
-- No change; striping occurs in outermost navbox.<br />
return wikitext .. orphanCat<br />
end<br />
local first, second = 'odd', 'even'<br />
if args.evenodd then<br />
if args.evenodd == 'swap' then<br />
first, second = second, first<br />
else<br />
first = args.evenodd<br />
second = first<br />
end<br />
end<br />
local changer<br />
if first == second then<br />
changer = first<br />
else<br />
local index = 0<br />
changer = function (code)<br />
if code == '0' then<br />
-- Current occurrence is for a group before a nested table.<br />
-- Set it to first as a valid although pointless class.<br />
-- The next occurrence will be the first row after a title<br />
-- in a subgroup and will also be first.<br />
index = 0<br />
return first<br />
end<br />
index = index + 1<br />
return index % 2 == 1 and first or second<br />
end<br />
end<br />
local regex = orphanCat:gsub('([%[%]])', '%%%1')<br />
return (wikitext:gsub(regex, ''):gsub(REGEX_MARKER, changer)) -- () omits gsub count<br />
end<br />
<br />
local function processItem(item, nowrapitems)<br />
if item:sub(1, 2) == '{|' then<br />
-- Applying nowrap to lines in a table does not make sense.<br />
-- Add newlines to compensate for trim of x in |parm=x in a template.<br />
return '\n' .. item ..'\n'<br />
end<br />
if nowrapitems == 'yes' then<br />
local lines = {}<br />
for line in (item .. '\n'):gmatch('([^\n]*)\n') do<br />
local prefix, content = line:match('^([*:;#]+)%s*(.*)')<br />
if prefix and not content:match('^<span class="nowrap">') then<br />
line = prefix .. '<span class="nowrap">' .. content .. '</span>'<br />
end<br />
table.insert(lines, line)<br />
end<br />
item = table.concat(lines, '\n')<br />
end<br />
if item:match('^[*:;#]') then<br />
return '\n' .. item ..'\n'<br />
end<br />
return item<br />
end<br />
<br />
local function renderNavBar(titleCell)<br />
<br />
if args.navbar ~= 'off' and args.navbar ~= 'plain' and not (not args.name and mw.getCurrentFrame():getParent():getTitle():gsub('/sandbox$', '') == 'Template:Navbox') then<br />
titleCell:wikitext(navbar{<br />
args.name,<br />
mini = 1,<br />
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;'<br />
})<br />
end<br />
<br />
end<br />
<br />
--<br />
-- Title row<br />
--<br />
local function renderTitleRow(tbl)<br />
if not args.title then return end<br />
<br />
local titleRow = tbl:tag('tr')<br />
<br />
if args.titlegroup then<br />
titleRow<br />
:tag('th')<br />
:attr('scope', 'row')<br />
:addClass('navbox-group')<br />
:addClass(args.titlegroupclass)<br />
:cssText(args.basestyle)<br />
:cssText(args.groupstyle)<br />
:cssText(args.titlegroupstyle)<br />
:wikitext(args.titlegroup)<br />
end<br />
<br />
local titleCell = titleRow:tag('th'):attr('scope', 'col')<br />
<br />
if args.titlegroup then<br />
titleCell<br />
:css('border-left', '2px solid #fdfdfd')<br />
:css('width', '100%')<br />
end<br />
<br />
local titleColspan = 2<br />
if args.imageleft then titleColspan = titleColspan + 1 end<br />
if args.image then titleColspan = titleColspan + 1 end<br />
if args.titlegroup then titleColspan = titleColspan - 1 end<br />
<br />
titleCell<br />
:cssText(args.basestyle)<br />
:cssText(args.titlestyle)<br />
:addClass('navbox-title')<br />
:attr('colspan', titleColspan)<br />
<br />
renderNavBar(titleCell)<br />
<br />
titleCell<br />
:tag('div')<br />
-- id for aria-labelledby attribute<br />
:attr('id', mw.uri.anchorEncode(args.title))<br />
:addClass(args.titleclass)<br />
:css('font-size', '114%')<br />
:css('margin', '0 4em')<br />
:wikitext(processItem(args.title))<br />
end<br />
<br />
--<br />
-- Above/Below rows<br />
--<br />
<br />
local function getAboveBelowColspan()<br />
local ret = 2<br />
if args.imageleft then ret = ret + 1 end<br />
if args.image then ret = ret + 1 end<br />
return ret<br />
end<br />
<br />
local function renderAboveRow(tbl)<br />
if not args.above then return end<br />
<br />
tbl:tag('tr')<br />
:tag('td')<br />
:addClass('navbox-abovebelow')<br />
:addClass(args.aboveclass)<br />
:cssText(args.basestyle)<br />
:cssText(args.abovestyle)<br />
:attr('colspan', getAboveBelowColspan())<br />
:tag('div')<br />
-- id for aria-labelledby attribute, if no title<br />
:attr('id', args.title and nil or mw.uri.anchorEncode(args.above))<br />
:wikitext(processItem(args.above, args.nowrapitems))<br />
end<br />
<br />
local function renderBelowRow(tbl)<br />
if not args.below then return end<br />
<br />
tbl:tag('tr')<br />
:tag('td')<br />
:addClass('navbox-abovebelow')<br />
:addClass(args.belowclass)<br />
:cssText(args.basestyle)<br />
:cssText(args.belowstyle)<br />
:attr('colspan', getAboveBelowColspan())<br />
:tag('div')<br />
:wikitext(processItem(args.below, args.nowrapitems))<br />
end<br />
<br />
--<br />
-- List rows<br />
--<br />
local function renderListRow(tbl, index, listnum)<br />
local row = tbl:tag('tr')<br />
<br />
if index == 1 and args.imageleft then<br />
row<br />
:tag('td')<br />
:addClass('navbox-image')<br />
:addClass(args.imageclass)<br />
:css('width', '1px') -- Minimize width<br />
:css('padding', '0px 2px 0px 0px')<br />
:cssText(args.imageleftstyle)<br />
:attr('rowspan', #listnums)<br />
:tag('div')<br />
:wikitext(processItem(args.imageleft))<br />
end<br />
<br />
if args['group' .. listnum] then<br />
local groupCell = row:tag('th')<br />
<br />
-- id for aria-labelledby attribute, if lone group with no title or above<br />
if listnum == 1 and not (args.title or args.above or args.group2) then<br />
groupCell<br />
:attr('id', mw.uri.anchorEncode(args.group1))<br />
end<br />
<br />
groupCell<br />
:attr('scope', 'row')<br />
:addClass('navbox-group')<br />
:addClass(args.groupclass)<br />
:cssText(args.basestyle)<br />
:css('width', args.groupwidth or '1%') -- If groupwidth not specified, minimize width<br />
<br />
groupCell<br />
:cssText(args.groupstyle)<br />
:cssText(args['group' .. listnum .. 'style'])<br />
:wikitext(args['group' .. listnum])<br />
end<br />
<br />
local listCell = row:tag('td')<br />
<br />
if args['group' .. listnum] then<br />
listCell<br />
:css('text-align', 'left')<br />
:css('border-left-width', '2px')<br />
:css('border-left-style', 'solid')<br />
else<br />
listCell:attr('colspan', 2)<br />
end<br />
<br />
if not args.groupwidth then<br />
listCell:css('width', '100%')<br />
end<br />
<br />
local rowstyle -- usually nil so cssText(rowstyle) usually adds nothing<br />
if index % 2 == 1 then<br />
rowstyle = args.oddstyle<br />
else<br />
rowstyle = args.evenstyle<br />
end<br />
<br />
local listText = args['list' .. listnum]<br />
local oddEven = ODD_EVEN_MARKER<br />
if listText:sub(1, 12) == '</div><table' then<br />
-- Assume list text is for a subgroup navbox so no automatic striping for this row.<br />
oddEven = listText:find('<th[^>]*"navbox%-title"') and RESTART_MARKER or 'odd'<br />
end<br />
listCell<br />
:css('padding', '0px')<br />
:cssText(args.liststyle)<br />
:cssText(rowstyle)<br />
:cssText(args['list' .. listnum .. 'style'])<br />
:addClass('navbox-list')<br />
:addClass('navbox-' .. oddEven)<br />
:addClass(args.listclass)<br />
:addClass(args['list' .. listnum .. 'class'])<br />
:tag('div')<br />
:css('padding', (index == 1 and args.list1padding) or args.listpadding or '0em 0.25em')<br />
:wikitext(processItem(listText, args.nowrapitems))<br />
<br />
if index == 1 and args.image then<br />
row<br />
:tag('td')<br />
:addClass('navbox-image')<br />
:addClass(args.imageclass)<br />
:css('width', '1px') -- Minimize width<br />
:css('padding', '0px 0px 0px 2px')<br />
:cssText(args.imagestyle)<br />
:attr('rowspan', #listnums)<br />
:tag('div')<br />
:wikitext(processItem(args.image))<br />
end<br />
end<br />
<br />
<br />
--<br />
-- Tracking categories<br />
--<br />
<br />
local function needsHorizontalLists()<br />
if border == 'subgroup' or args.tracking == 'no' then<br />
return false<br />
end<br />
local listClasses = {<br />
['plainlist'] = true, ['hlist'] = true, ['hlist hnum'] = true,<br />
['hlist hwrap'] = true, ['hlist vcard'] = true, ['vcard hlist'] = true,<br />
['hlist vevent'] = true,<br />
}<br />
return not (listClasses[args.listclass] or listClasses[args.bodyclass])<br />
end<br />
<br />
local function hasBackgroundColors()<br />
for _, key in ipairs({'titlestyle', 'groupstyle', 'basestyle', 'abovestyle', 'belowstyle'}) do<br />
if tostring(args[key]):find('background', 1, true) then<br />
return true<br />
end<br />
end<br />
end<br />
<br />
local function hasBorders()<br />
for _, key in ipairs({'groupstyle', 'basestyle', 'abovestyle', 'belowstyle'}) do<br />
if tostring(args[key]):find('border', 1, true) then<br />
return true<br />
end<br />
end<br />
end<br />
<br />
local function isIllegible()<br />
local styleratio = require('Module:Color contrast')._styleratio<br />
<br />
for key, style in pairs(args) do<br />
if tostring(key):match("style$") then<br />
if styleratio{mw.text.unstripNoWiki(style)} < 4.5 then<br />
return true<br />
end<br />
end<br />
end<br />
return false<br />
end<br />
<br />
local function getTrackingCategories()<br />
local cats = {}<br />
if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end<br />
if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end<br />
if isIllegible() then table.insert(cats, 'Potentially illegible navboxes') end<br />
if hasBorders() then table.insert(cats, 'Navboxes using borders') end<br />
return cats<br />
end<br />
<br />
local function renderTrackingCategories(builder)<br />
local title = mw.title.getCurrentTitle()<br />
if title.namespace ~= 10 then return end -- not in template space<br />
local subpage = title.subpageText<br />
if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end<br />
<br />
for _, cat in ipairs(getTrackingCategories()) do<br />
builder:wikitext('[[Category:' .. cat .. ']]')<br />
end<br />
end<br />
<br />
--<br />
-- Main navbox tables<br />
--<br />
local function renderMainTable()<br />
local tbl = mw.html.create('table')<br />
:addClass('nowraplinks')<br />
:addClass(args.bodyclass)<br />
<br />
if args.title and (args.state ~= 'plain' and args.state ~= 'off') then<br />
if args.state == 'collapsed' then args.state = 'mw-collapsed' end<br />
tbl<br />
:addClass('mw-collapsible')<br />
:addClass(args.state or 'autocollapse')<br />
end<br />
<br />
tbl:css('border-spacing', 0)<br />
if border == 'subgroup' or border == 'none' then<br />
tbl<br />
:addClass('navbox-subgroup')<br />
:cssText(args.bodystyle)<br />
:cssText(args.style)<br />
else -- regular navbox - bodystyle and style will be applied to the wrapper table<br />
tbl<br />
:addClass('navbox-inner')<br />
:css('background', 'transparent')<br />
:css('color', 'inherit')<br />
end<br />
tbl:cssText(args.innerstyle)<br />
<br />
renderTitleRow(tbl)<br />
renderAboveRow(tbl)<br />
for i, listnum in ipairs(listnums) do<br />
renderListRow(tbl, i, listnum)<br />
end<br />
renderBelowRow(tbl)<br />
<br />
return tbl<br />
end<br />
<br />
function p._navbox(navboxArgs)<br />
args = navboxArgs<br />
listnums = {}<br />
<br />
for k, _ in pairs(args) do<br />
if type(k) == 'string' then<br />
local listnum = k:match('^list(%d+)$')<br />
if listnum then table.insert(listnums, tonumber(listnum)) end<br />
end<br />
end<br />
table.sort(listnums)<br />
<br />
border = mw.text.trim(args.border or args[1] or '')<br />
if border == 'child' then<br />
border = 'subgroup'<br />
end<br />
<br />
-- render the main body of the navbox<br />
local tbl = renderMainTable()<br />
<br />
-- render the appropriate wrapper around the navbox, depending on the border param<br />
local res = mw.html.create()<br />
if border == 'none' then<br />
local nav = res:tag('div')<br />
:attr('role', 'navigation')<br />
:node(tbl)<br />
-- aria-labelledby title, otherwise above, otherwise lone group<br />
if args.title or args.above or (args.group1 and not args.group2) then<br />
nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title or args.above or args.group1))<br />
else<br />
nav:attr('aria-label', 'Navbox')<br />
end<br />
elseif border == 'subgroup' then<br />
-- We assume that this navbox is being rendered in a list cell of a parent navbox, and is<br />
-- therefore inside a div with padding:0em 0.25em. We start with a </div> to avoid the<br />
-- padding being applied, and at the end add a <div> to balance out the parent's </div><br />
res<br />
:wikitext('</div>')<br />
:node(tbl)<br />
:wikitext('<div>')<br />
else<br />
local nav = res:tag('div')<br />
:attr('role', 'navigation')<br />
:addClass('navbox')<br />
:addClass(args.navboxclass)<br />
:cssText(args.bodystyle)<br />
:cssText(args.style)<br />
:css('padding', '3px')<br />
:node(tbl)<br />
-- aria-labelledby title, otherwise above, otherwise lone group<br />
if args.title or args.above or (args.group1 and not args.group2) then<br />
nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title or args.above or args.group1))<br />
else<br />
nav:attr('aria-label', 'Navbox')<br />
end<br />
end<br />
<br />
if (args.nocat or 'false'):lower() == 'false' then<br />
renderTrackingCategories(res)<br />
end<br />
return striped(tostring(res))<br />
end<br />
<br />
function p.navbox(frame)<br />
if not getArgs then<br />
getArgs = require('Module:Arguments').getArgs<br />
end<br />
args = getArgs(frame, {wrappers = {'Template:Navbox', 'Template:Navbox subgroup'}})<br />
if frame.args.border then<br />
-- This allows Template:Navbox_subgroup to use {{#invoke:Navbox|navbox|border=...}}.<br />
args.border = frame.args.border<br />
end<br />
<br />
-- Read the arguments in the order they'll be output in, to make references number in the right order.<br />
local _<br />
_ = args.title<br />
_ = args.above<br />
for i = 1, 20 do<br />
_ = args["group" .. tostring(i)]<br />
_ = args["list" .. tostring(i)]<br />
end<br />
_ = args.below<br />
<br />
return p._navbox(args)<br />
end<br />
<br />
return p</div>
it>MusikAnimal