Module:Sandbox/trappist the monk/table of cs1 modules at other wikis explained

require('strict');

local get_args = require ('Module:Arguments').getArgs;local mw_languages_by_tag_t = mw.language.fetchLanguageNames ('en', 'all');local interwiki_map =

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

local function main (frame) local args_t = get_args (frame); local qid = mw.wikibase.getEntityIdForTitle (args_t[1]); -- get the qid for this module; nil else if not qid then return '

no qid for ' .. args_t[1] .. ''; -- no qid then abandon end local sitelinks_t = ; local wd_sitelinks_t = mw.wikibase.getEntity (qid)["sitelinks"]; for interwiki, wd_sitelink_t in pairs (wd_sitelinks_t) do local site_info_t = ; local lang_tag = wd_sitelink_t['site']:match ('([%a_]+)wik'):gsub ('_', '%-'); -- language tag; underscores replaces with hyphens local lang_name = 'no language'; if mw_languages_by_tag_t[lang_tag] then lang_name = mw_languages_by_tag_t[lang_tag] .. ' (' .. lang_tag .. ')'; -- () end table.insert (site_info_t, lang_name);

local project = wd_sitelink_t['site']:match ('[%a_]+(wik.*)'); project = ('wiki'

project) and 'wikipedia' or project; project = project:gsub ('^(%a)', string.upper); -- first letter uppercase table.insert (site_info_t, project); -- wikipedia, wikisource, wikiversity, etc

interwiki = interwiki:match ('%a+(wik.*)'); -- get the project interwiki = interwiki_map[interwiki]; -- map to shorthand table.insert (site_info_t, ''); -- make an interwikilink sitelinks_t[wd_sitelink_t['site']] = site_info_t; -- add these data to sitelinks_t end local row_data_t = ; -- a sequence table of row data extracted from sitelinks_t for _, sitelink_t in pairs (sitelinks_t) do local row_t = ; -- initialize for _, item in ipairs (sitelink_t) do table.insert (row_t, item); end local row = '| ' .. table.concat (row_t, ' || ') .. ' || || ||'; -- build wikitable row markup table.insert (row_data_t, row); -- and save the row end table.sort (row_data_t); -- ascending sort by language name local out = table.concat (row_data_t, '\n|-\n'); -- make a big string with more wikitable markup; next assemble caption, headings, and row data into finished table out = '

Link !! Date !! Maintainer !! class="unsortable"
Comments\n-\n' .. out .. '\n
' return out; -- doneend

----------------------------< E X P O R T S >----------------------------------------------------------------

return