--Just smashing things togetherrequire('strict');
local p = ;
local ac = require('Module:Authority control');
local rt = require('Module:Redirect template');
local function renderMainTable local tbl = mw.html.create('table') :addClass('nowraplinks') :addClass('hlist')
tbl:css('border-spacing', 0) if border
'none' then tbl :addClass('navbox-subgroup') :cssText(args.bodystyle) :cssText(args.style) else -- regular navbox - bodystyle and style will be applied to the wrapper table tbl :addClass('navbox-inner') :css('background', 'transparent') :css('color', 'inherit') end tbl:cssText(args.innerstyle)
renderTitleRow(tbl) renderAboveRow(tbl) for i, listnum in ipairs(listnums) do renderListRow(tbl, i, listnum) end renderBelowRow(tbl)
return tblend
function p.newTable(navboxArgs) listnums =
for k, _ in pairs(args) do if type(k)
border = mw.text.trim(args.border or args[1] or ) if border
-- render the main body of the navbox local tbl = renderMainTable
-- render the appropriate wrapper around the navbox, depending on the border param local res = mw.html.create if border
'subgroup' then -- We assume that this navbox is being rendered in a list cell of a parent navbox, and is -- therefore inside a div with padding:0em 0.25em. We start with a
to balance out the parent's
res :wikitext('') :node(tbl) :wikitext('
') else local nav = res:tag('div') :attr('role', 'navigation') :addClass('navbox') :addClass(args.navboxclass) :cssText(args.bodystyle) :cssText(args.style) :css('padding', '3px') :node(tbl) -- aria-labelledby title, otherwise above, otherwise lone group if args.title or args.above or (args.group1 and not args.group2) then nav:attr('aria-labelledby', mw.uri.anchorEncode(args.title or args.above or args.group1)) else nav:attr('aria-label', 'Navbox') end end
if (args.nocat or 'false'):lower
function p.main(frame) local resolveEntity = require('Module:ResolveEntityId') local parentArgs = frame:getParent.args --WD IDs added here later local iParentArgs = 0 --count original/manual parent args only later local worldcatCat = local multipleIdCat = local suppressedIdCat = local deprecatedIdCat = local differentOnWDCat = local sameOnWDCat = --Redirect aliases to proper parameter names for _, a in pairs(ac.aliases) do local alias, param = a[1], a[2] if (parentArgs[param]
) and parentArgs[alias] then parentArgs[param] = parentArgs[alias] end end --Redirect deprecated parameters to proper parameter names, and assign tracking cat for _, d in pairs(ac.deprecated) do local dep, param = d[1], d[2] if (parentArgs[param]
) and parentArgs[dep] then parentArgs[param] = parentArgs[dep] if namespace
nil or val
and (namespace
then local bMatch = false for _, wd in pairs(wikidataIds) do if val
false then differentOnWDCat = '' end end end end end if iMatches > 0 and iMatches
'function' then table.insert(tval, val) if params.prefix then table.insert(tlinks, params[3](val, '1')) else table.insert(tlinks, params[3](val)) end end --collect other unique vals (IDs) from WD, if present if itemId and tval[1] then local nextIdVal = 2 local wikidataIds = ac.getIdsFromWikidata(itemId, 'P'..params[2]) for _, v in pairs(wikidataIds) do local bnew = true for _, w in pairs(tval) do if v
nil then --if WORLDCATID absent but unsuppressed local viafId = parentArgs['viaf'] or parentArgs['VIAF'] local lccnId = parentArgs['lccn'] or parentArgs['LCCN'] if viafId and viafId ~= and ac.viafLink(viafId) then --VIAF must be present, unsuppressed, & validated table.insert(sections['General'], ac.createRow('VIAF', viafId, 'WorldCat (via VIAF)', nil, false)) if namespace
0 then worldcatCat = '' end end rct = rct + 1 end elseif worldcatId
--- XXX: this is a HORRIBLE HACK. kill it with fire as soon as https://bugzilla.wikimedia.org/show_bug.cgi?id=12974 is fixed local beCompatibleWithBug12974 = args.info and (args.info:find('^[:;#*]', 1)
', titleAC, p.newTable ) for k,v in pairs(namespaceCategories) do if args[k .. ' category'] then if type(v[1])
namespace then content = content .. string.format('', args[k .. ' category']) elseif args['other category'] then content = content .. string.format('', args['other category']) else content = content .. frame:expandTemplate end end end return contentend-- rt.main(frame)--end