Module:links/data: Difference between revisions

From Linguifex
Jump to navigation Jump to search
Created page with "local data = {} data.high_memory_entries = { "a", "animal", "book", "coffee", "do", "e", "language", "night", "smoke", "son", "sun", "water", "wind", } local U..."
 
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
local data = {}
local data = {}


data.high_memory_entries = {
local unpack = unpack or table.unpack -- Lua 5.2 compatibility
"a",
local u = require("Module:string utilities").char
"animal",
 
"book",
data.phonetic_extraction = {
"coffee",
["th"] = "Module:th",
"do",
["km"] = "Module:km",
"e",
"language",
"night",
"smoke",
"son",
"sun",
"water",
"wind",
}
}


data.ignored_prefixes = {
["cat"] = true,
["category"] = true,
["file"] = true,
["image"] = true
}


local U = mw.ustring.char
-- Scheme for using unsupported characters in titles.
local soft_hyphen = U(0xAD)
data.unsupported_characters = {
["#"] = "`num`",
["%"] = "`percnt`", -- only escaped in percent encoding
["&"] = "`amp`", -- only escaped in HTML entities
["."] = "`period`", -- only escaped in dot-slash notation
["<"] = "`lt`",
[">"] = "`gt`",
["["] = "`lsqb`",
["]"] = "`rsqb`",
["_"] = "`lowbar`",
["`"] = "`grave`", -- used to enclose unsupported characters in the scheme, so a raw use in an unsupported title must be escaped to prevent interference
["{"] = "`lcub`",
["|"] = "`vert`",
["}"] = "`rcub`",
["~"] = "`tilde`", -- only escaped when 3 or more are consecutive
["\239\191\189"] = "`repl`" -- replacement character U+FFFD, which can't be typed directly here due to an abuse filter
}


--[[ The "actual title" is the page name with the prefix "Unsupported titles/" removed.
-- Manually specified unsupported titles. Only put titles here if there is a different reason why they are unsupported, and not just because they contain one of the unsupported characters above.
["displayed_title"] = "actual title" ]]
data.unsupported_titles = {
data.unsupported_titles = {
[" "] = "Space",
[" "] = "Space",
["{"] = "Left curly bracket",
["&amp;"] = "`amp`amp;",
["}"] = "Right curly bracket",
["λοπαδοτεμαχοσελαχογαλεοκρανιολειψανοδριμυποτριμματοσιλφιοκαραβομελιτοκατακεχυμενοκιχλεπικοσσυφοφαττοπεριστεραλεκτρυονοπτοκεφαλλιοκιγκλοπελειολαγῳοσιραιοβαφητραγανοπτερύγων"] = "Ancient Greek dish",
["["] = "Left square bracket",
["]"] = "Right square bracket",
["<"] = "Less than",
[">"] = "Greater than",
["=<"] = "Equal less than",
["=>"] = "Equal greater than",
[">="] = "Greater than equal",
["<="] = "Less than equal",
["->"] = "Hyphen greater than",
["<-"] = "Less than hyphen",
[">_<"] = "Greater than low line less than",
["::"] = "Double colon",
[": :"] = "Enclosing colons",
[":="] = "Colon equals",
[":Þ"] = "Colon capital thorn",
[":("] = "Colon left paren",
[":)"] = "Colon right paren",
["<>"] = "Less than greater than",
["<3"] = "Less than three",
["</3"] = "Less than slash three",
["< >"] = "Enclosing less than greater than",
["< />"] = "Less than trailing slash greater than",
["< > </ >"] = "HTML start tag end tag",
["<!-- -->"] = "HTML comment",
["<g>"] = "g tag",
[":-("] = "Colon hyphen left paren",
[":-)"] = "Colon hyphen right paren",
["|"] = "Vertical line",
["||"] = "Vertical line vertical line",
["| |"] = "Enclosing vertical lines",
["C#"] = "C sharp",
["#"] = "Number sign",
["# #"] = "Enclosing number signs",
[":"] = "Colon",
[".."] = "Double period",
["."] = "Full stop",
["_"] = "Low line",
["-_-"] = "Low line interfix",
[U(0xFFFD)] = "Replacement character",
[U(0x1680)] = "Ogham space",
["[ ]"] = "Square brackets",
["{ }"] = "Curly brackets",
["[…]"] = "Square bracketed ellipsis",
["_ _"] = "Enclosing low lines",
["C|N>K"] = "C through N to K",
["#MeToo"] = "MeToo",
["о/."] = "о slash dot",
["กรุงเทพมหานคร อมรรัตนโกสินทร์ มหินทรายุธยา มหาดิลกภพ นพรัตนราชธานีบูรีรมย์ อุดมราชนิเวศน์มหาสถาน อมรพิมานอวตารสถิต สักกะทัตติยวิษณุกรรมประสิทธิ์"] = "Thai name of Bangkok",
["กรุงเทพมหานคร อมรรัตนโกสินทร์ มหินทรายุธยา มหาดิลกภพ นพรัตนราชธานีบูรีรมย์ อุดมราชนิเวศน์มหาสถาน อมรพิมานอวตารสถิต สักกะทัตติยวิษณุกรรมประสิทธิ์"] = "Thai name of Bangkok",
["λοπαδοτεμαχοσελαχογαλεοκρανιολειψανοδριμυποτριμματοσιλφιοκαραβομελιτοκατακεχυμενοκιχλ" .. soft_hyphen .. "επικοσσυφοφαττοπεριστεραλεκτρυονοπτοκεφαλλιοκιγκλοπελειολαγῳοσιραιοβαφητραγανοπτερύγων"] = "Ancient Greek dish",
[u(0x1680)] = "Ogham space",
[":≠"] = ":≠",
[u(0x3000)] = "Ideographic space"
["S:t"] = "S:t",
}
["S:ta"] = "S:ta",
 
["c:a"] = "c:a",
-- Mammoth pages contain only Translingual and English entries, if present. The remaining L2s are placed on subpages.
["n:a"] = "n:a",
-- The same subpage titles are used across all mammoth pages for the convenience of bot and script operators.
["n:o"] = "n:o",
-- Assuming that most mammoth pages will be Latin-script terms, the subpage groupings are determined by dividing the
["n:r"] = "n:r",
-- list of Latin-script languages known to Wiktionary into two (three, ...) roughly equal alphabetic divisions. This is
["s:a"] = "s:a",
-- easily done by looking at Petscan's output:
["st:a"] = "st:a",
-- https://petscan.wmcloud.org/?sortby=title&language=en&ns%5B14%5D=1&categories=Latin+script+languages&project=wiktionary&doit=
["v:a"] = "v:a",
-- This data structure contains types of splits, each of which is a list of names of splits and Lua patterns applied to
-- the decomposed L2 name (with apostrophes and double quotes removed and certain other transformations applied; see
-- get_L2_sort_key() in [[Module:headword/page]]), or "true" for the final catch-all subpage (which includes anything
-- not beginning with a Latin letter after the transformations are applied; this includes e.g. ǃKung but not 'Are'are,
-- which sorts with A, and not Àhàn, which likewise sorts with A). The patterns must be suitable for use with plain
-- string functions, not their mw.ustring equivalents.
data.mammoth_page_subpage_types = {
twos = {
{"languages A to L", "^[A-L]"},
{"languages M to Z", true},
},
threes = {
{"languages A to I", "^[A-I]"},
{"languages J to Q", "^[J-Q]"},
{"languages R to Z", true},
},
CJK = {
{"languages A to C", "^[A-C]"}, -- Translingual and Chinese on one page
{"languages D to Z", true}, -- all the remainder (mostly Japanese, Korean, Vietnamese) on the other
},
}
}


for i, item in ipairs(data.high_memory_entries) do
-- "Mammoth pages" are pages whose entries cannot be housed on a single page because of MediaWiki limits. The key is
data.high_memory_entries[i] = nil
-- the page and the value is the subpage type, as defined above in `mammoth_page_subpage_types`.
data.high_memory_entries[item] = true
data.mammoth_pages = {
end
["mammoth page test"] = "twos",  -- required for testing purposes - please leave here
}


return data
return data

Latest revision as of 15:11, 29 April 2026



local data = {}

local unpack = unpack or table.unpack -- Lua 5.2 compatibility
local u = require("Module:string utilities").char

data.phonetic_extraction = {
	["th"] = "Module:th",
	["km"] = "Module:km",
}

data.ignored_prefixes = {
	["cat"] = true,
	["category"] = true,
	["file"] = true,
	["image"] = true
}

-- Scheme for using unsupported characters in titles.
data.unsupported_characters = {
	["#"] = "`num`",
	["%"] = "`percnt`", -- only escaped in percent encoding
	["&"] = "`amp`", -- only escaped in HTML entities
	["."] = "`period`", -- only escaped in dot-slash notation
	["<"] = "`lt`",
	[">"] = "`gt`",
	["["] = "`lsqb`",
	["]"] = "`rsqb`",
	["_"] = "`lowbar`",
	["`"] = "`grave`", -- used to enclose unsupported characters in the scheme, so a raw use in an unsupported title must be escaped to prevent interference
	["{"] = "`lcub`",
	["|"] = "`vert`",
	["}"] = "`rcub`",
	["~"] = "`tilde`", -- only escaped when 3 or more are consecutive
	["\239\191\189"] = "`repl`" -- replacement character U+FFFD, which can't be typed directly here due to an abuse filter
}

-- Manually specified unsupported titles. Only put titles here if there is a different reason why they are unsupported, and not just because they contain one of the unsupported characters above.
data.unsupported_titles = {
	[" "] = "Space",
	["&amp;"] = "`amp`amp;",
	["λοπαδοτεμαχοσελαχογαλεοκρανιολειψανοδριμυποτριμματοσιλφιοκαραβομελιτοκατακεχυμενοκιχλεπικοσσυφοφαττοπεριστεραλεκτρυονοπτοκεφαλλιοκιγκλοπελειολαγῳοσιραιοβαφητραγανοπτερύγων"] = "Ancient Greek dish",
	["กรุงเทพมหานคร อมรรัตนโกสินทร์ มหินทรายุธยา มหาดิลกภพ นพรัตนราชธานีบูรีรมย์ อุดมราชนิเวศน์มหาสถาน อมรพิมานอวตารสถิต สักกะทัตติยวิษณุกรรมประสิทธิ์"] = "Thai name of Bangkok",
	[u(0x1680)] = "Ogham space",
	[u(0x3000)] = "Ideographic space"
}

-- Mammoth pages contain only Translingual and English entries, if present. The remaining L2s are placed on subpages.
-- The same subpage titles are used across all mammoth pages for the convenience of bot and script operators.
-- Assuming that most mammoth pages will be Latin-script terms, the subpage groupings are determined by dividing the
-- list of Latin-script languages known to Wiktionary into two (three, ...) roughly equal alphabetic divisions. This is
-- easily done by looking at Petscan's output:
-- https://petscan.wmcloud.org/?sortby=title&language=en&ns%5B14%5D=1&categories=Latin+script+languages&project=wiktionary&doit=
-- This data structure contains types of splits, each of which is a list of names of splits and Lua patterns applied to
-- the decomposed L2 name (with apostrophes and double quotes removed and certain other transformations applied; see
-- get_L2_sort_key() in [[Module:headword/page]]), or "true" for the final catch-all subpage (which includes anything
-- not beginning with a Latin letter after the transformations are applied; this includes e.g. ǃKung but not 'Are'are,
-- which sorts with A, and not Àhàn, which likewise sorts with A). The patterns must be suitable for use with plain
-- string functions, not their mw.ustring equivalents.
data.mammoth_page_subpage_types = {
	twos = {
		{"languages A to L", "^[A-L]"},
		{"languages M to Z", true},
	},
	threes = {
		{"languages A to I", "^[A-I]"},
		{"languages J to Q", "^[J-Q]"},
		{"languages R to Z", true},
	},
	CJK = {
		{"languages A to C", "^[A-C]"}, -- Translingual and Chinese on one page
		{"languages D to Z", true}, -- all the remainder (mostly Japanese, Korean, Vietnamese) on the other
	},
}

-- "Mammoth pages" are pages whose entries cannot be housed on a single page because of MediaWiki limits. The key is
-- the page and the value is the subpage type, as defined above in `mammoth_page_subpage_types`.
data.mammoth_pages = {
	["mammoth page test"] = "twos",   -- required for testing purposes - please leave here
}

return data