Module:Sandbox/Trappist the monk/deprecated sources

--[[ 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:	 or  (the second indicates that the source is blacklisted) (Status column) then look for:	 (apparently can accept up to twenty domains) (Uses column) For each of the domains in the  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	--  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  out_t[domain] = true;													-- and add it to  with a value of boolean true; duplicates if any are overwritten end end

--[[--< M A I N >--

return  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 }