Module:Sandbox/trappist the monk/interwiki list explained

--

require ('strict');local data = mw.loadData ('Module:Sandbox/trappist the monk/interwiki list/data');local error_message = '

missing or invalid list specifier parameter in invoke'

----------------------------< R E N D E R >------------------------------------------------------------------

returns a plainlist-styled list indented 1.6em; uses Plainlist/styles.css

local function render (frame, list) return table.concat ;end

--[=[-------------------------< B Y _ T A G >------------------------------------------------------------------ for use on [[Wikipedia:Template_index/Redirect_language_codes_–_code_sort]]

The function takes a single argument, a lowercase alpha letter (expected to be Latn script) and returns a listof language tags that begin with that letter and the associated names sorted alphabetically by language tag.

This invoke returns the list of tags and names where all of the tags have 'a' as the first character:

returns a plainlist-styled list or an error message

]=]

local function by_tag (frame) local index = frame.args[1]:lower; -- enforce lowercase if 1 ~= index:len or not data.inter_wiki_map_indexed_by_tag_t[index] then return error_message; end return render (frame, data.inter_wiki_map_indexed_by_tag_t[index]);end

--[=[-------------------------< B Y _ N A M E >---------------------------------------------------------------- for use on [[Wikipedia:Template_index/Redirect_language_codes]]

The function takes a single argument, a lowercase alpha letter and returns a list of language names that beginwith that letter and the associated tags sorted alphabetically by language name. Sorting is case agnostic.

This invoke returns the list of names and tags where all of the names have 'A' or 'a' as the first character:

The mw.ustring library is used in this function to aid i18n

returns a plainlist-styled list or an error message

]=]

local function by_name (frame) local index = mw.ustring.lower (frame.args[1]); -- enforce lowercase if 1 ~= mw.ustring.len (index) or not data.inter_wiki_map_indexed_by_name_t[index] then return error_message; end return render (frame, data.inter_wiki_map_indexed_by_name_t[index]);end

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

return