Enwikipedia>Jackmcbarn |
Enwikipedia>Jackmcbarn |
Line 256: |
Line 256: |
|
-- Tracking categories |
|
-- Tracking categories |
|
-- |
|
-- |
⚫ |
local function renderTrackingCategories(builder) |
|
⚫ |
local frame = mw.getCurrentFrame() |
|
⚫ |
|
|
⚫ |
if not frame then return end |
|
⚫ |
|
|
⚫ |
local s = frame:preprocess('{{#ifeq:{{NAMESPACE}}|{{ns:10}}|1|0}}{{SUBPAGENAME}}') |
|
⚫ |
if mw.ustring.sub(s, 1, 1) == '0' then return end -- not in template space |
|
⚫ |
local subpage = mw.ustring.lower(mw.ustring.sub(s, 2)) |
|
⚫ |
if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end |
|
⚫ |
|
|
⚫ |
for i, cat in ipairs(getTrackingCategories()) do |
|
⚫ |
builder.wikitext('[[Category:' .. cat .. ']]') |
|
⚫ |
|
|
⚫ |
|
|
|
|
|
⚫ |
local function getTrackingCategories() |
|
⚫ |
|
|
⚫ |
if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end |
|
⚫ |
if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end |
|
⚫ |
|
|
⚫ |
|
|
|
|
|
|
|
local function needsHorizontalLists() |
|
local function needsHorizontalLists() |
Line 295: |
Line 274: |
|
end |
|
end |
|
|
|
|
|
⚫ |
local function getTrackingCategories() |
|
⚫ |
|
|
⚫ |
if needsHorizontalLists() then table.insert(cats, 'Navigational boxes without horizontal lists') end |
|
⚫ |
if hasBackgroundColors() then table.insert(cats, 'Navboxes using background colours') end |
|
⚫ |
|
|
⚫ |
|
|
|
|
|
⚫ |
local function renderTrackingCategories(builder) |
|
⚫ |
local frame = mw.getCurrentFrame() |
|
⚫ |
|
|
⚫ |
if not frame then return end |
|
⚫ |
|
|
⚫ |
local s = frame:preprocess('{{#ifeq:{{NAMESPACE}}|{{ns:10}}|1|0}}{{SUBPAGENAME}}') |
|
⚫ |
if mw.ustring.sub(s, 1, 1) == '0' then return end -- not in template space |
|
⚫ |
local subpage = mw.ustring.lower(mw.ustring.sub(s, 2)) |
|
⚫ |
if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end |
|
⚫ |
|
|
⚫ |
for i, cat in ipairs(getTrackingCategories()) do |
|
⚫ |
builder.wikitext('[[Category:' .. cat .. ']]') |
|
⚫ |
|
|
⚫ |
|
|
|
|
|
|
-- |
|
-- |