Module:headword: Difference between revisions
No edit summary |
No edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| 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 806: | Line 807: | ||
local canonical = lang:getCanonicalName() | local canonical = lang:getCanonicalName() | ||
local tbl, sortkey = page.wikitext_topic_cat[lang:getCode()] | local tbl, sortkey = page.wikitext_topic_cat[lang:getCode()] | ||
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 | end | ||
end | end | ||
| Line 947: | Line 946: | ||
-- 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 956: | ||
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,046: | ||
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,057: | ||
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,106: | ||
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,135: | ||
-- 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,452: | ||
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 | ||