Module:headword/page: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
 
Line 731: Line 731:
-- Get the pagename.
-- Get the pagename.
pagename = gsub(raw_title.subpageText, "^Unsupported titles/(.+)", function(m)
pagename = gsub(raw_title.subpageText, "^Unsupported titles/(.+)", function(m)
insert(cats, "Unsupported titles")
local title = (unsupported_titles or get_unsupported_titles())[m]
local title = (unsupported_titles or get_unsupported_titles())[m]
if title then
if title then
Line 836: Line 835:
L2_list[L2_list_len] = name
L2_list[L2_list_len] = name
L2_sections[heading.section] = name
L2_sections[heading.section] = name
-- Also add any L1s, since they terminate the preceding L2, but add a maintenance category since it's probably a mistake.
 
if level == 1 then
new_cats["Pages with unwanted L1 headings"] = false
end
-- Check the heading is in the right order.
-- Check the heading is in the right order.
-- FIXME: we need a more sophisticated sorting method which handles non-diacritic special characters (e.g. Magɨ).
-- FIXME: we need a more sophisticated sorting method which handles non-diacritic special characters (e.g. Magɨ).
Line 846: Line 842:
string_sort(get_weight(prev), get_weight(name))
string_sort(get_weight(prev), get_weight(name))
) then
) then
new_cats["Pages with language headings in the wrong order"] = false
L2_wrong_order = true
L2_wrong_order = true
end
end
Line 854: Line 849:
local function handle_template(template)
local function handle_template(template)
local name = template:get_name()
local name = template:get_name()
if name == "DEFAULTSORT:" then
if name == "DISPLAYTITLE:" then
new_cats["Pages with DEFAULTSORT conflicts"] = false
new_cats["Pages with DISPLAYTITLE conflicts"] = true
elseif name == "DISPLAYTITLE:" then
new_cats["Pages with DISPLAYTITLE conflicts"] = false
end
end
end
end
Line 868: Line 861:
elseif node_class == "template" then
elseif node_class == "template" then
handle_template(node)
handle_template(node)
elseif node_class == "parameter" then
new_cats["Pages with raw triple-brace template parameters"] = false
end
end
end
end
Line 885: Line 876:
------ 4. Parse page for maintenance categories. ------
------ 4. Parse page for maintenance categories. ------
-- Use of tab characters.
-- Use of tab characters.
if content and find(content, "\t", 1, true) then
insert(cats, get_category("Pages with tab characters"))
end
-- Unencoded character(s) in title.
-- Unencoded character(s) in title.
local IDS = list_to_set{"⿰", "⿱", "⿲", "⿳", "⿴", "⿵", "⿶", "⿷", "⿸", "⿹", "⿺", "⿻", "⿼", "⿽", "⿾", "⿿", "㇯"}
local IDS = list_to_set{"⿰", "⿱", "⿲", "⿳", "⿴", "⿵", "⿶", "⿷", "⿸", "⿹", "⿺", "⿻", "⿼", "⿽", "⿾", "⿿", "㇯"}
for char in pairs(explode_pagename) do
if IDS[char] and char ~= data.pagename then
insert(cats, "Terms containing unencoded characters")
break
end
end


-- Raw wikitext use of a topic or langname category. Also check if any raw sortkeys have been used.
-- Raw wikitext use of a topic or langname category. Also check if any raw sortkeys have been used.
Line 994: Line 976:
data.wikitext_topic_cat = wikitext_topic_cat
data.wikitext_topic_cat = wikitext_topic_cat
data.wikitext_langname_cat = wikitext_langname_cat
data.wikitext_langname_cat = wikitext_langname_cat
if raw_sortkey then
 
insert(cats, get_category("Pages with raw sortkeys"))
end
end
end


Navigation menu