Module:headword: Difference between revisions
No edit summary |
No edit summary |
||
| Line 436: | Line 436: | ||
if not saw_translit_page and data.lang:hasType("etymology-only") then | if not saw_translit_page and data.lang:hasType("etymology-only") then | ||
langname = data.lang:getFullName() | langname = data.lang:getFullName() | ||
transliteration_page = new_title(langname .. " transliteration | transliteration_page = new_title(langname .. " transliteration") | ||
if transliteration_page and transliteration_page:getContent() then | if transliteration_page and transliteration_page:getContent() then | ||
translits_formatted = " [[ | translits_formatted = " [[" .. langname .. " transliteration|•]]" .. translits_formatted | ||
end | end | ||
end | end | ||
| Line 620: | Line 620: | ||
local title = mw.title.new(stripped_physical_term) | local title = mw.title.new(stripped_physical_term) | ||
if title and not title:getContent() then | if title and not title:getContent() then | ||
insert(data.categories, data.lang:getFullName() .. " " .. plpos .. " with red links in their headword lines") | |||
return true | return true | ||
end | end | ||
| Line 788: | Line 789: | ||
-- that. | -- that. | ||
if tbl == true then | if tbl == true then | ||
if page.raw_defaultsort ~= sortkey then | |||
insert(lang_cats, lang:getFullName() .. " terms with non-redundant non-automated sortkeys") | |||
end | |||
return | return | ||
end | end | ||
| Line 797: | Line 801: | ||
different = true | different = true | ||
end | end | ||
end | |||
if redundant then | |||
insert(lang_cats, lang:getFullName() .. " terms with redundant sortkeys") | |||
end | |||
if different then | |||
insert(lang_cats, lang:getFullName() .. " terms with non-redundant non-automated sortkeys") | |||
end | end | ||
return sortkey | return sortkey | ||
| Line 808: | Line 818: | ||
if tbl then | if tbl then | ||
sortkey = handle_raw_sortkeys(tbl, sortkey, page, lang, lang_cats) | sortkey = handle_raw_sortkeys(tbl, sortkey, page, lang, lang_cats) | ||
insert(lang_cats, canonical .. " entries with topic categories using raw markup") | |||
end | end | ||
tbl = page.wikitext_langname_cat[canonical] | tbl = page.wikitext_langname_cat[canonical] | ||
if tbl then | if tbl then | ||
handle_raw_sortkeys(tbl, sortkey, page, lang, lang_cats) | handle_raw_sortkeys(tbl, sortkey, page, lang, lang_cats) | ||
insert(lang_cats, canonical .. " entries with language name categories using raw markup") | |||
end | |||
if get_current_L2() ~= canonical then | |||
insert(lang_cats, canonical .. " entries with incorrect language header") | |||
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/incorrect language header]] | |||
-- [[Special:WhatLinksHere/Wiktionary:Tracking/headword/incorrect language header/LANGCODE]] | |||
track("incorrect language header", lang) | |||
end | end | ||
end | end | ||
| Line 947: | Line 965: | ||
-- add an appropriate category. | -- add an appropriate category. | ||
local postype = export.pos_lemma_or_nonlemma(data.pos_category) | local postype = export.pos_lemma_or_nonlemma(data.pos_category) | ||
if not postype then | if not postype then | ||
elseif not data.noposcat then | elseif not data.noposcat then | ||
local main_cat = data.lang:getMainCategoryName() | |||
if postype:match("^lemma") and main_cat ~= "lemma" then | if postype:match("^lemma") and main_cat ~= "lemma" then | ||
postype = main_cat | postype = main_cat | ||
| Line 955: | Line 975: | ||
insert(data.categories, 1, full_langname .. " " .. postype .. "s") | insert(data.categories, 1, full_langname .. " " .. postype .. "s") | ||
end | end | ||
insert(data.categories, 1, "Contionary") | insert(data.categories, 1, "Contionary") | ||
| Line 1,045: | Line 1,065: | ||
local auto_sc = data.lang:findBestScript(head.term) | local auto_sc = data.lang:findBestScript(head.term) | ||
if ( | |||
auto_sc:getCode() == "None" and | |||
find_best_script_without_lang(head.term):getCode() ~= "None" | |||
) then | |||
insert(data.categories, full_langname .. " terms in nonstandard scripts") | |||
end | |||
if not (head.sc or data.sc) then -- No script code given, so use autodetected script. | if not (head.sc or data.sc) then -- No script code given, so use autodetected script. | ||
head.sc = auto_sc | head.sc = auto_sc | ||
| Line 1,050: | Line 1,076: | ||
if not head.sc then -- Overall script code given. | if not head.sc then -- Overall script code given. | ||
head.sc = data.sc | head.sc = data.sc | ||
end | |||
-- Track uses of sc parameter. | |||
if head.sc:getCode() == auto_sc:getCode() then | |||
track("redundant script code", data.lang) | |||
if not data.no_script_code_cat then | |||
insert(data.categories, full_langname .. " terms with redundant script codes") | |||
end | |||
else | |||
track("non-redundant manual script code", data.lang) | |||
if not data.no_script_code_cat then | |||
insert(data.categories, full_langname .. " terms with non-redundant manual script codes") | |||
end | |||
end | end | ||
end | end | ||
| Line 1,087: | Line 1,125: | ||
if automated_tr then | if automated_tr then | ||
local manual_tr = head.tr | local manual_tr = head.tr | ||
if manual_tr then | |||
if remove_links(manual_tr) == remove_links(automated_tr) then | |||
insert(data.categories, full_langname .. " terms with redundant transliterations") | |||
else | |||
insert(data.categories, full_langname .. " terms with non-redundant manual transliterations") | |||
end | |||
end | |||
if not manual_tr then | if not manual_tr then | ||
| Line 1,108: | Line 1,154: | ||
-- Link to the transliteration entry for languages that require this. | -- Link to the transliteration entry for languages that require this. | ||
if head.tr | if head.tr and data.lang:link_tr(head.sc) then | ||
head.tr = full_link{ | head.tr = full_link{ | ||
term = head.tr, | term = head.tr, | ||
| Line 1,425: | Line 1,471: | ||
insert(data.categories, full_langname .. " terms spelled with " .. character) | insert(data.categories, full_langname .. " terms spelled with " .. character) | ||
end | end | ||
end | |||
end | |||
if data.heads[1].sc:isSystem("alphabet") then | |||
local pagename, i = page.pagename:ulower(), 2 | |||
while umatch(pagename, "(%a)" .. ("%1"):rep(i)) do | |||
i = i + 1 | |||
insert(data.categories, full_langname .. " terms with " .. i .. " consecutive instances of the same letter") | |||
end | end | ||
end | end | ||