--[[
make a table of domain names that are deprecated. For a source use:
Wikipedia:Reliable sources/Perennial sources
which has a wikitable of sources. The sources are listed in §Sources more-or-less alphabetically. Look for:
((/Status|d)) or ((/Status|d|b=y)) (the second indicates that the source is blacklisted) (Status column)
then look for:
((/Uses|<domain>|<domain>|...)) (apparently can accept up to twenty domains) (Uses column)
For each of the domains in the ((/Uses)) template create a table entry where the key is the domain name and
the value is boolean true.
To use, Module:Citation/CS1 must extract the domain from |url= then test against the content of the table
produced by this code.
Not suitable for i18n?
]]
local content = mw.title.new ('Wikipedia:Reliable sources/Perennial sources'):getContent();
local out_t = {}; -- table of deprecated domains
for raw_domains in content:gmatch ('(( */Status *| *d.-(( */Uses *|([^}]+)') do -- <raw_domains> from deprecated uses
raw_domains = mw.text.trim (raw_domains); -- get rid of leading/trailing whitespace
local domains_t = mw.text.split (raw_domains, '%s*|%s*'); -- split the string into a sequence
for _, domain in ipairs (domains_t) do -- get whatever is in <domains_t>
out_t[domain] = true; -- and add it to <out_t> with a value of boolean true; duplicates if any are overwritten
end
end
--[[--------------------------< M A I N >----------------------------------------------------------------------
return <out_t> rendered by mw.dumpObject()
((#invoke:Sandbox/Trappist the monk/deprecated sources|main))
]]
local function main ()
return mw.dumpObject (out_t)
end
--[[--------------------------< E X P O R T S >----------------------------------------------------------------
]]
return {
main = main,
out_t = mw.dumpObject (out_t), -- for use with debug console
}