Module:headword: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 169: Line 169:
-- If set to true, categories always appear, even in non-mainspace pages
-- If set to true, categories always appear, even in non-mainspace pages
local test_force_categories = false
local test_force_categories = false


local function text_in_script(text, script_code)
local function text_in_script(text, script_code)
Line 384: Line 385:


local langname = data.lang:getCanonicalName()
local langname = data.lang:getCanonicalName()
local transliteration_page = langname .. " transliteration"
local transliteration_page = new_title(langname .. " transliteration", "Wiktionary")
local saw_translit_page = false
local saw_translit_page = false


if transliteration_page and transliteration_page.exists then
if transliteration_page and transliteration_page.exists then
translits_formatted = " [[" .. langname .. " transliteration|•]]" .. translits_formatted
translits_formatted = " [[Wiktionary:" .. langname .. " transliteration|•]]" .. translits_formatted
saw_translit_page = true
saw_translit_page = true
end
end
Line 395: Line 396:
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 = langname .. " transliteration"
transliteration_page = new_title(langname .. " transliteration", "Wiktionary")


if transliteration_page and transliteration_page.exists then
if transliteration_page and transliteration_page.exists then
translits_formatted = " [[" .. langname .. " transliteration|•]]" .. translits_formatted
translits_formatted = " [[Wiktionary:" .. langname .. " transliteration|•]]" .. translits_formatted
end
end
end
end
Line 462: Line 463:
-- right into the 'data' table to disable inflection links of the entire headword
-- right into the 'data' table to disable inflection links of the entire headword
-- when inflected forms aren't entry-worthy, e.g.: in Vulgar Latin
-- when inflected forms aren't entry-worthy, e.g.: in Vulgar Latin
local nolinkinfl = part.face == "hypothetical" or part.nolinkinfl or data.nolinkinfl
local nolinkinfl = part.face == "hypothetical" or part.nolinkinfl or data.nolinkinfl


local formatted
local formatted
Line 665: Line 666:
-- 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 674: Line 678:
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 687: Line 697:
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")
end
end
end
end
Line 816: Line 831:
-- 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 data.noposcat then
if not postype then
    if postype == "lemma" then
elseif not data.noposcat then
    postype = data.lang:getMainCategoryName()
    end
insert(data.categories, 1, full_langname .. " " .. postype .. "s")
insert(data.categories, 1, full_langname .. " " .. postype .. "s")
end
end
Line 848: Line 860:
if is_reconstructed then
if is_reconstructed then
default_head = "*" .. default_head
default_head = "*" .. default_head
default_head = default_head:gsub("%*%*", "*")
end
end
 
------------ 6. Fill in missing values in `data.heads`. ------------
------------ 6. Fill in missing values in `data.heads`. ------------


Line 881: Line 892:


------ 6b. Try to detect the script(s) if not provided. If a per-head script is provided, that takes precedence,
------ 6b. Try to detect the script(s) if not provided. If a per-head script is provided, that takes precedence,
------    otherwise fall back to the overall script if given. If neither given, autodetect the script.
------ 6b. Try to detect the script(s) if not provided. If a per-head script is provided, that takes precedence,
------    otherwise fall back to the overall script if given. If neither given, autodetect the script.
------    otherwise fall back to the overall script if given. If neither given, autodetect the script.


Line 1,264: Line 1,272:
insert(data.categories, full_langname .. " palindromes")
insert(data.categories, full_langname .. " palindromes")
end
end
 
if data.affix then
for _, aff in ipairs(data.affix) do
if mw.ustring.match(aff, "^%-[^-]*%-$") then
table.insert(data.categories, data.lang:getCanonicalName() .. " words interfixed with " .. aff)
elseif mw.ustring.match(aff, "%-%s%-") then
table.insert(data.categories, data.lang:getCanonicalName() .. " words circumfixed with " .. aff)
elseif mw.ustring.match(aff, "%-$") then
table.insert(data.categories, data.lang:getCanonicalName() .. " words prefixed with " .. aff)
elseif mw.ustring.match(aff, "^%-") then
table.insert(data.categories, data.lang:getCanonicalName() .. " words suffixed with " .. aff)
end
end
end
-- Add to various maintenance categories.
-- Add to various maintenance categories.
export.maintenance_cats(page, data.lang, data.categories, data.whole_page_categories)
export.maintenance_cats(page, data.lang, data.categories, data.whole_page_categories)

Navigation menu