Module:Quotations
local export = {}
-- it is either here, or in Module:ugly hacks, and it is not in ugly hacks. function export.CONTENTMODEL() return mw.title.getCurrentTitle().contentModel end
local skins = { ["common" ] = ""; ["vector" ] = "Vector"; ["monobook" ] = "Monobook"; ["cologneblue"] = "Cologne Blue"; ["modern" ] = "Modern"; }
local Array = require "Module:array"
local function compare_pages(page1, page2, text) return "[" .. tostring( mw.uri.fullUrl("Special:ComparePages", { page1 = page1, page2 = page2 })) .. " " .. text .. "]" end
local function page_exists(title) local success, title_obj = pcall(mw.title.new, title) return success and title_obj.exists end
-- Avoid transcluding Module:languages/cache everywhere. local lang_cache = setmetatable({}, { __index = function (self, k) return require "Module:languages/cache"[k] end })
local function zh_link(word) return require("Module:links").full_link{ lang = lang_cache.zh, term = word } end
local function make_languages_data_documentation(title, cats, division) local doc_template, module_cat if division:find("/extra$") then division = division:gsub("/extra$", "") doc_template = "language extradata documentation" module_cat = "Language extra data modules" else doc_template = "language data documentation" module_cat = "Language data modules" end local sort_key if division == "exceptional" then sort_key = "x" else sort_key = division:gsub("/", "") end cats:insert(module_cat .. "|" .. sort_key) return mw.getCurrentFrame():expandTemplate { title = doc_template } end
local function make_Unicode_data_documentation(title, cats) local subpage, first_three_of_code_point = title.fullText:match("^Module:Unicode data/([^/]+)/(%x%x%x)$") if subpage == "names" or subpage == "images" then local low, high = tonumber(first_three_of_code_point .. "000", 16), tonumber(first_three_of_code_point .. "FFF", 16) return string.format( "This data module contains the %s of " .. "Unicode code points within the range U+%04X to U+%04X.", subpage == "images" and "titles of images" or "names", low, high) end end
-- This provides categories and documentation for various data modules, so that -- isn’t unnecessarily cluttered. -- It is a list of tables, each of which have the following possible fields:
-- `regex` (required): A Lua pattern to match the module's title. If it matches, the data in this entry will be used. -- Any captures in the pattern can by referenced in the `cat` field using %1 for the first capture, %2 for the -- second, etc. (often used for creating the sortkey for the category). In addition, the captures are passed to the -- `process` function as the third and subsequent parameters.
-- `process` (optional): This may be a function or a string. If it is a function, it is called as follows: -- process(TITLE, CATS, CAPTURE1, CAPTURE2, ...) -- where: -- * TITLE is a title object describing the module's title; see [1]. -- * CATS is an array object (see Module:array) of categories that the module will be added to. -- * CAPTURE1, CAPTURE2, ... contain any captures in the `regex` field. -- The return value of `process` should be a string and will be used as the module's documentation. -- If `process` is a string, it is the name of a submodule under 'Module:documentation/functions/' which returns a -- function, of the same type as described above. If `process` is omitted entirely, the module will have no -- documentation.
-- `cat` (optional): A string naming the category into which the module should be placed. Captures specified in `regex`
-- may be referenced in this string using %1 for the first capture, %2 for the second, etc. Currently, in order to put
-- the module into multiple categories, you need to write a `process` function that adds categories to the CATS
-- parameter passed in.
local module_regex = {
{
regex = "^Module:languages/data/(3/./extra)$",
process = make_languages_data_documentation,
},
{
regex = "^Module:languages/data/(3/.)$",
process = make_languages_data_documentation,
},
{
regex = "^Module:languages/data/(2/extra)$",
process = make_languages_data_documentation,
},
{
regex = "^Module:languages/data/(2)$",
process = make_languages_data_documentation,
},
{
regex = "^Module:languages/data/(exceptional/extra)$",
process = make_languages_data_documentation,
},
{
regex = "^Module:languages/data/(exceptional)$",
process = make_languages_data_documentation,
},
{
regex = "^Module:languages/.+$",
cat = "Language and script modules",
},
{
regex = "^Module:scripts/.+$",
cat = "Language and script modules",
},
{
regex = "^Module:data tables/data..?.?.?$",
cat = "Reference module sharded data tables",
},
{
regex = "^Module:zh/data/dial%-pron/.+$",
cat = "Chinese dialectal pronunciation data modules",
process = "zh dial or syn",
},
{
regex = "^Module:zh/data/dial%-syn/.+$",
cat = "Chinese dialectal synonyms data modules",
process = "zh dial or syn",
},
{
regex = "^Module:zh/data/glyph%-data/.+$",
cat = "Chinese historical character forms data modules",
process = function(title, cats)
local character = title.fullText:match("^Module:zh/data/glyph%-data/(.+)")
if character then
return ("This module contains data on historical forms of the Chinese character %s.")
:format(zh_link(character))
end
end,
},
{
regex = "^Module:zh/data/ltc%-pron/(.+)$",
cat = "Middle Chinese pronunciation data modules|%1",
process = "zh data",
},
{
regex = "^Module:zh/data/och%-pron%-BS/(.+)$",
cat = "Old Chinese (Baxter-Sagart) pronunciation data modules|%1",
process = "zh data",
},
{
regex = "^Module:zh/data/och%-pron%-ZS/(.+)$",
cat = "Old Chinese (Zhengzhang) pronunciation data modules|%1",
process = "zh data",
},
{
-- capture rest of zh/data submodules
regex = "^Module:zh/data/(.+)$",
cat = "Chinese data modules|%1",
},
{
regex = "^Module:mul/guoxue%-data/cjk%-?(.*)$",
process = "guoxue-data",
},
{
regex = "^Module:Unicode data/(.+)$",
cat = "Unicode data modules|%1",
process = make_Unicode_data_documentation,
},
{
regex = "^Module:number list/data/(.+)$",
process = "number list",
},
{
regex = "^Module:accel/(.+)$",
process = function(title, cats)
local lang_code = title.subpageText
local lang = lang_cache[lang_code]
if lang then
cats:insert(lang:getCanonicalName() .. " modules|accel")
cats:insert(("Accel submodules|%s"):format(lang:getCanonicalName()))
return ("This module contains new entry creation rules for %s; see WT:ACCEL for an overview, and Module:accel for information on creating new rules.")
:format(lang:makeCategoryLink())
end
end,
},
{
regex = "^Module:inc%-ash/dial/data/(.+)$",
cat = "Ashokan Prakrit modules|%1",
process = function(title, cats)
local word = title.fullText:match("^Module:inc%-ash/dial/data/(.+)$")
if word then
local lang = lang_cache["inc-ash"]
return ("This module contains data on the pronunciation of %s in dialects of %s.")
:format(require("Module:links").full_link({ term = word, lang = lang }, "term"),
lang:makeCategoryLink())
end
end,
},
{
regex = "^Module:[%l-]+:Dialects$",
process = function(title, cats)
local content = title:getContent()
local has_aliases = content:find("aliases") ~= nil
return mw.getCurrentFrame():expandTemplate {
title = "dialectal data module",
args = { ["labels-aliases"] = has_aliases },
}
end,
},
{
regex = "^.+%-translit$",
process = "translit",
},
{
regex = "^Module:form of/lang%-data/(.+)$",
process = function(title, cats, lang_code)
local lang = lang_cache[lang_code]
if lang then
local langname = lang:getCanonicalName()
cats:insert("Language-specific form-of modules|" .. lang_code)
cats:insert(langname .. " modules")
cats:insert(langname .. " data modules")
-- FIXME, display more info.
return "This module contains language-specific form-of data (tags, shortcuts, base lemma params. etc.) for " ..
langname .. ".\n\nNOTE: If you add a new language-specific module, you must add the language code to the " ..
"list at the top of Module:form of in order for the module to be recognized."
end
end
},
{
regex = "^Module:labels/data/lang/(.+)$",
process = function(title, cats, lang_code)
local lang = lang_cache[lang_code]
if lang then
local langname = lang:getCanonicalName()
cats:insert("Language-specific label data modules|" .. lang_code)
cats:insert(langname .. " modules")
cats:insert(langname .. " data modules")
return mw.getCurrentFrame():expandTemplate {
title = "label language-specific data documentation",
args = { [1] = lang_code },
}
end
end
},
{
regex = "^Module:category tree/poscatboiler/data/lang%-specific/(.+)$",
process = function(title, cats, lang_code)
local lang = lang_cache[lang_code]
if lang then
local langname = lang:getCanonicalName()
cats:insert("Category tree data modules/poscatboiler|" .. langname)
cats:insert(langname .. " modules")
cats:insert(langname .. " data modules")
return "This module handles generating the descriptions and categorization for " .. langname .. " category pages "
.. "of the format \"" .. langname .. " LABEL\" where LABEL can be any text. Examples are "
.. "Category:Bulgarian conjugation 2.1 verbs and Category:Russian velar-stem neuter-form nouns. "
.. "This module is part of the poscatboiler system, which is a general framework for generating the "
.. "descriptions and categorization of category pages.\n\n"
.. "For more information, see Module:category tree/poscatboiler/data/lang-specific/documentation.\n\n"
.. "NOTE: If you add a new language-specific module, you must add the language code to the "
.. "list at the top of Module:category tree/poscatboiler/data/lang-specific in order for the module to be "
.. "recognized."
end
end
},
{
regex = "^Module:category tree/poscatboiler/data/(.+)$",
process = function(title, cats, lang_code)
cats:insert("Category tree data modules/poscatboiler| ")
return mw.getCurrentFrame():expandTemplate {
title = "poscatboiler data submodule documentation"
}
end
},
{
regex = "^Module:category tree/topic cat/data/(.+)$",
process = function(title, cats, lang_code)
return mw.getCurrentFrame():expandTemplate {
title = "topic cat data submodule documentation"
}
end
},
{
regex = "^Module:ja/data/(.+)$",
cat = "Japanese data modules|%1",
},
{
regex = "^Module:Swadesh/data/(.+)$",
cat = "Swadesh modules|%1",
},
{
regex = "^Module:typing%-aids",
process = function(title, cats)
local data_suffix = title.fullText:match("^Module:typing%-aids/data/(.+)$")
if data_suffix then
cats:insert("Data modules")
if data_suffix:find "^[%l-]+$" then
local lang = require "Module:languages".getByCode(data_suffix)
if lang then
cats:insert(lang:getCanonicalName() .. " modules")
end
elseif data_suffix:find "^%u%l%l%l$" then
local script = require "Module:scripts".getByCode(data_suffix)
if script then
cats:insert(script:getCategoryName())
end
end
end
end,
},
{
regex = "^Module:R:([a-z%-]+):(.+)$",
process = function(title, cats, lang_code, refname)
local lang = lang_cache[lang_code]
if lang then
cats:insert(lang:getCanonicalName() .. " modules|" .. refname)
cats:insert(("Reference modules|%s"):format(lang:getCanonicalName()))
return mw.getCurrentFrame():preprocess("This module implements the reference template {{[[Plantilya:R:" ..
lang_code .. ":" .. refname .. "|R:" ..
lang_code .. ":" .. refname .. "]]}}
.")
end
end,
},
{
regex = "^Module:Quotations/([a-z-]+)/?(.*)",
process = "Quotation",
},
{
regex = "^Module:affix/lang%-data/([a-z-]+)",
process = "affix lang-data",
}
}
function export.show(frame) local params = { ["hr"] = {}, ["for"] = {}, ["from"] = {}, ["notsubpage"] = { type = "boolean", default = false }, ["nodoc"] = { type = "boolean", default = false }, }
local args = require("Module:parameters").process(frame.args, params)
local output = Array('\n
local cats = Array()
local nodoc = args.nodoc
if (not args.hr) or (args.hr == "above") then output:insert("----\n") end
local title = ((args['for'] ~= "") and args['for']) and mw.title.new(args['for']) or mw.title.getCurrentTitle() local doc_title = mw.title.new((args['from'] ~= "") and args['from'] or (title.fullText .. '/documentation')) local contentModel = title.contentModel
local pagetype = mw.getContentLanguage():lcfirst(title.nsText) .. " page" local preload, fallback_docs, doc_content, doc_content_module, old_doc_title, user_name, skin_name, needs_doc
if contentModel == "javascript" then pagetype = "script" if title.nsText == 'MediaWiki' then if title.text:find('Gadget-') then preload = 'Template:documentation/preloadGadget' else preload = 'Template:documentation/preloadMediaWikiJavaScript' end else preload = 'Template:documentation/preloadTemplate' -- XXX end if title.nsText == 'User' then user_name = title.rootText end elseif contentModel == "css" then pagetype = "style sheet" preload = 'Template:documentation/preloadTemplate' -- XXX if title.nsText == 'User' then user_name = title.rootText end elseif contentModel == "Scribunto" then pagetype = "module" user_name = title.rootText:match("^[Uu]ser:(.+)") if user_name then preload = 'Template:documentation/preloadModuleSandbox' else preload = 'Template:documentation/preloadModule' end elseif title.nsText == "Template" then pagetype = "template" preload = 'Template:documentation/preloadTemplate' elseif title.nsText == "Wiktionary" then pagetype = "project page" preload = 'Template:documentation/preloadTemplate' -- XXX end
if doc_title.isRedirect then old_doc_title = doc_title doc_title = mw.title.new(string.match(doc_title:getContent(), "^#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*%[%[([^%[%]]-)%]%]")) end
output:insert("- ")
if doc_title.exists then
output:insert(
"
- The following " .. "documentation is located at [[" .. doc_title.fullText .. "]]. " .. "[[" .. doc_title:fullUrl { action = 'edit' } .. " edit]] ") else if contentModel == "Scribunto" then local automatic_cats = nil if user_name then fallback_docs = "documentation/fallback/user module" automatic_cats = {"User sandbox modules"} else for _, data in ipairs(module_regex) do local captures = {mw.ustring.match(title.fullText, data.regex)} if #captures > 0 then local cat local process_function if type(data.process) == "function" then process_function = data.process elseif type(data.process) == "string" then doc_content_module = "Module:documentation/functions/" .. data.process process_function = require(doc_content_module) end if process_function then doc_content = process_function(title, cats, unpack(captures)) end cat = data.cat if cat then if type(cat) == "string" then cat = {cat} end for _, c in ipairs(cat) do -- gsub() and Lua :gsub() return two arguments, which causes all sorts of problems. -- Terrible design, there should have been a separate two-argument function. local gsub_sucks = mw.ustring.gsub(title.fullText, data.regex, c) table.insert(cats, gsub_sucks) end end break end end end if not automatic_cats then local success, auto_cats = pcall(require("Module:module categorization").categorize, frame, true) if success then for _, category in ipairs(auto_cats) do cats:insert(category) end end end if title.subpageText == "templates" then cats:insert("Template interface modules") end if automatic_cats then for _, c in ipairs(automatic_cats) do cats:insert(c) end end -- meaning module is not in user’s sandbox or one of many datamodule boring series needs_doc = not (automatic_cats or doc_content or fallback_docs) elseif title.nsText == "Template" then --cats:insert("Uncategorized templates") needs_doc = not (fallback_docs or nodoc) elseif (contentModel == "css") or (contentModel == "javascript") then if user_name then skin_name = skins[title.text:sub(#title.rootText + 1):match("^/([a-z]+)%.[jc]ss?$")] if skin_name then fallback_docs = 'documentation/fallback/user ' .. contentModel end end end if doc_content then local generating_module = doc_content_module or "Module:documentation" output:insert( "
- The following " .. "documentation is " .. "generated by " .. generating_module .. ". [[" .. mw.title.new(generating_module):fullUrl { action = 'edit' } .. " edit]] ") elseif not nodoc then output:insert( "
- This " .. pagetype .. " lacks a documentation subpage. " .. (fallback_docs and "You may " or "Please ") .. "[" .. doc_title:fullUrl { action = 'edit', preload = preload } .. " create it]. \n") end end if title.fullText:match("^MediaWiki:Gadget%-") then local is_gadget = false local gadget_list = mw.title.new("MediaWiki:Gadgets-definition"):getContent() for line in mw.text.gsplit(gadget_list, "\n") do local gadget, opts, items = line:match("^%*%s*([A-Za-z][A-Za-z0-9_%-]*)%[(.-)%]|(.+)$") -- opts is unused if not gadget then gadget, items = line:match("^%*%s*([A-Za-z][A-Za-z0-9_%-]*)|(.+)$") end if gadget then items = Array(mw.text.split(items, "|")) for i, item in ipairs(items) do if title.fullText == ("MediaWiki:Gadget-" .. item) then is_gadget = true output:insert("
- This script is a part of the
")
output:insert(gadget) output:insert("
gadget ([") output:insert(tostring(mw.uri.fullUrl('MediaWiki:Gadgets-definition', 'action=edit'))) output:insert(" edit definitions])- ")
output:insert("
- Description ([") output:insert(tostring(mw.uri.fullUrl('MediaWiki:Gadget-' .. gadget, 'action=edit'))) output:insert(" edit]): ") local gadget_description = mw.message.new('Gadget-' .. gadget):plain() gadget_description = frame:preprocess(gadget_description) output:insert(gadget_description) output:insert(" ") items:remove(i) if #items > 0 then for j, item in ipairs(items) do items[j] = '' .. item .. '' end output:insert("
- Other parts: ") output:insert(mw.text.listToText(items)) output:insert(" ") end output:insert("
")
- This script is not a part of any [") output:insert(tostring(mw.uri.fullUrl('Special:Gadgets', 'uselang=en'))) output:insert(' gadget] ([') output:insert(tostring(mw.uri.fullUrl('MediaWiki:Gadgets-definition', 'action=edit'))) output:insert(' edit definitions]). ') -- else -- cats:insert("Wiktionary gadgets") end end if old_doc_title then output:insert("
- Redirected from [") output:insert(old_doc_title:fullUrl { redirect = 'no' }) output:insert(" ") output:insert(old_doc_title.fullText) output:insert("] ([") output:insert(old_doc_title:fullUrl { action = 'edit' }) output:insert(" edit]). \n") end local links = Array() if title.isSubpage and not args.notsubpage then links:insert("root page") links:insert("root page’s subpages") else links:insert("subpage list") end links:insert( '[' .. tostring(mw.uri.fullUrl('Special:WhatLinksHere/' .. title.fullText, 'hidetrans=1&hideredirs=1')) .. ' links]') if contentModel ~= "Scribunto" then links:insert( '[' .. tostring(mw.uri.fullUrl('Special:WhatLinksHere/' .. title.fullText, 'hidelinks=1&hidetrans=1')) .. ' redirects]') end if (contentModel == "javascript") or (contentModel == "css") then if user_name then links:insert("your own") end else links:insert( '[' .. tostring(mw.uri.fullUrl('Special:WhatLinksHere/' .. title.fullText, 'hidelinks=1&hideredirs=1')) .. ' transclusions]') end if contentModel == "Scribunto" then local is_testcases = title.isSubpage and title.subpageText == "testcases" local without_subpage = title.nsText .. ":" .. title.baseText if is_testcases then links:insert("tested module") else links:insert("testcases") end if user_name then links:insert("user page") links:insert("user talk page") links:insert("userspace") else -- If sandbox module, add a link to the module that this is a sandbox of. -- Exclude user sandbox modules like User:Dine2016/sandbox. if title.text:find("/sandbox%d*%f[/%z]") then cats:insert("Sandbox modules") -- Sandbox modules don’t really need documentation. needs_doc = false -- Will behave badly if “/sandbox” occurs twice in title! local sandbox_of = title.fullText:gsub("/sandbox%d*%f[/%z]", "") local diff if page_exists(sandbox_of) then diff = " (" .. compare_pages(title.fullText, sandbox_of, "diff") .. ")" else require("Module:debug").track("documentation/no sandbox of") end links:insert("sandbox of" .. (diff or "")) -- If not a sandbox module, add link to sandbox module. -- Sometimes there are multiple sandboxes for a single module: -- Module:sa-pronunc/sandbox, Module:sa-pronunc/sandbox2. -- Occasionally sandbox modules have their own subpages that are also -- sandboxes: Module:grc-decl/sandbox/decl. else local sandbox_title if title.fullText:find("^Module:grc%-decl/") then sandbox_title = title.fullText:gsub("^Module:grc%-decl/", "Module:grc-decl/sandbox/") elseif is_testcases then sandbox_title = title.fullText:gsub("/testcases", "/sandbox/testcases") else sandbox_title = title.fullText .. "/sandbox" end local sandbox_link = "sandbox" local diff if page_exists(sandbox_title) then diff = " (" .. compare_pages(title.fullText, sandbox_title, "diff") .. ")" end links:insert(sandbox_link .. (diff or "")) end end end if title.nsText == "Template" then -- Error search: all(any namespace), hastemplate (show pages using the template), insource (show source code), incategory (any/specific error) -- mw:Help:CirrusSearch, w:Help:Searching/Regex -- apparently same with/without: &profile=advanced&fulltext=1 local errorq = 'searchengineselect=mediawiki&search=all: hastemplate:\"'..title.rootText..'\" insource:\"'..title.rootText..'\" incategory:' local eincategory = "Pages_with_module_errors|ParserFunction_errors|DisplayTitle_errors|Pages_with_ISBN_errors|Pages_with_ISSN_errors|Pages_with_reference_errors|Pages_with_syntax_highlighting_errors|Pages_with_TemplateStyles_errors" links:insert( '[' .. tostring(mw.uri.fullUrl('Special:Search', errorq..eincategory )) .. ' errors]' .. ' (' .. '[' .. tostring(mw.uri.fullUrl('Special:Search', errorq..'ParserFunction_errors' )) .. ' parser]' .. '/' .. '[' .. tostring(mw.uri.fullUrl('Special:Search', errorq..'Pages_with_module_errors' )) .. ' module]' .. ')' ) if title.isSubpage and title.text:find("/sandbox%d*%f[/%z]") then -- This is a sandbox template. -- At the moment there are no user sandbox templates with subpage -- “/sandbox”. cats:insert("Sandbox templates") -- Sandbox templates don’t really need documentation. needs_doc = false -- Will behave badly if “/sandbox” occurs twice in title! local sandbox_of = title.fullText:gsub("/sandbox%d*%f[/%z]", "") local diff if page_exists(sandbox_of) then diff = " (" .. compare_pages(title.fullText, sandbox_of, "diff") .. ")" else require("Module:debug").track("documentation/no sandbox of") end links:insert("sandbox of" .. (diff or "")) else -- This is a template that can have a sandbox. local sandbox_title = title.fullText .. "/sandbox" local diff if page_exists(sandbox_title) then diff = " (" .. compare_pages(title.fullText, sandbox_title, "diff") .. ")" end links:insert("sandbox" .. (diff or "")) end end if #links > 0 then output:insert("
- Useful links: " .. links:concat(" • ") .. " ") end output:insert("
break end end end end
if not is_gadget then
output:insert("-- Show error from Module:category tree/topic cat/data on its submodules' -- documentation to, for instance, warn about duplicate labels. if title.fullText:find("Module:category tree/topic cat/data", 1, true) == 1 then local ok, err = pcall(require, "Module:category tree/topic cat/data") if not ok then output:insert('' .. err .. '\n\n') end end
if doc_title.exists then -- Override automatic documentation, if present. doc_content = frame:expandTemplate { title = doc_title.fullText } elseif not doc_content and fallback_docs then doc_content = frame:expandTemplate { title = fallback_docs; args = { ['user'] = user_name; ['page'] = title.fullText; ['skin name'] = skin_name; } } end
if doc_content then output:insert(doc_content) end
output:insert(('\n<%s style="clear: both;" />'):format(args.hr == "below" and "hr" or "br"))
if not cats[1] and not doc_content then if contentModel == "Scribunto" then cats:insert("Uncategorized modules") -- elseif title.nsText == "Template" then -- cats:insert("Uncategorized templates") end end
if needs_doc then cats:insert("Templates and modules needing documentation") end
for _, cat in ipairs(cats) do output:insert("") end
output:insert("\n")
return output:concat() end
-- Used by This module will transliterate Undeterminedna tataramon text.
The module should preferably not be called directly from templates or other modules. To use it from a template, use {{xlit}}
. Within a module, use Module:languages#Language:transliterate.
For testcases, see Module:Quotations/testcases.
Functions
[baguhon]tr(text, lang, sc)
- Transliterates a given piece of
text
written in the script specified by the codesc
, and language specified by the codelang
. When the transliteration fails, returnsnil
.
Lua error in Module:module_categorization at line 56: Category name was not recognized... function export.translitModuleLangList(frame) local pagename, subpage
if frame.args[1] then pagename = frame.args[1] else local title = mw.title.getCurrentTitle() subpage = title.subpageText pagename = title.text
if subpage ~= pagename then pagename = title.rootText end end
local translitModule = pagename
local languageObjects = require("Module:languages/byTranslitModule")(translitModule) local codeInPagename = pagename:match("^([%l-]+)%-.*translit$")
local categories = Array() local codeInPagenameInList = false if codeInPagename then if languageObjects[1] and subpage ~= "documentation" then local agreement = languageObjects[2] and "s" or "" categories:insert("[[Category:Transliteration modules used by " .. #languageObjects .. " language" .. agreement .. "]]") end
languageObjects = Array(languageObjects) :filter( function (lang) local result = lang:getCode() ~= codeInPagename codeInPagenameInList = codeInPagenameInList or result return result end) end
if subpage ~= "documentation" then for script_code in pagename:gmatch("%f[^-%z]%u%l%l%l%f[-]") do local script = require "Module:scripts".getByCode(script_code) if script then categories:insert("") end end end
if subpage ~= "documentation" and not page_exists("Module:" .. pagename .. "/testcases") then categories:insert("") end
if not languageObjects[1] then return categories:concat() end
local langs = Array(languageObjects) :sort( function(lang1, lang2) return lang1:getCode() < lang2:getCode() end) -- This will not error because languageObjects is not empty. :map(languageObjects[1].makeCategoryLink) :serial_comma_join()
return "It is " .. ( codeInPagenameInList and "also" or "" ) .. " used to transliterate " .. langs .. "." .. categories:concat() end
-- Used by Plantilya:entry name module documentation. function export.entryNameModuleLangList(frame) local pagename, subpage
if frame.args[1] then pagename = frame.args[1] else local title = mw.title.getCurrentTitle() subpage = title.subpageText pagename = title.text
if subpage ~= pagename then pagename = title.rootText end end
local entryNameModule = pagename
local languageObjects = require("Module:languages/byEntryNameModule")(entryNameModule) local codeInPagename = pagename:match("^([%l-]+)%-.*entryname$")
local categories = Array() local codeInPagenameInList = false if codeInPagename then if languageObjects[1] and subpage ~= "documentation" then local agreement = languageObjects[2] and "s" or "" categories:insert("[[Category:Entry name-generating modules used by " .. #languageObjects .. " language" .. agreement .. "]]") end
languageObjects = Array(languageObjects) :filter( function (lang) local result = lang:getCode() ~= codeInPagename codeInPagenameInList = codeInPagenameInList or result return result end) end
if subpage ~= "documentation" then for script_code in pagename:gmatch("%f[^-%z]%u%l%l%l%f[-]") do local script = require "Module:scripts".getByCode(script_code) if script then categories:insert("") end end end
if subpage ~= "documentation" and not page_exists("Module:" .. pagename .. "/testcases") then categories:insert("") end
if not languageObjects[1] then return categories:concat() end
local langs = Array(languageObjects) :sort( function(lang1, lang2) return lang1:getCode() < lang2:getCode() end) -- This will not error because languageObjects is not empty. :map(languageObjects[1].makeCategoryLink) :serial_comma_join()
return "It is " .. ( codeInPagenameInList and "also" or "" ) .. " used to generate entry names for " .. langs .. "." .. categories:concat() end
-- Used by Plantilya:sortkey module documentation. function export.sortkeyModuleLangList(frame) local pagename, subpage
if frame.args[1] then pagename = frame.args[1] else local title = mw.title.getCurrentTitle() subpage = title.subpageText pagename = title.text
if subpage ~= pagename then pagename = title.rootText end end
local sortkeyModule = pagename
local languageObjects = require("Module:languages/bySortkeyModule")(sortkeyModule) local codeInPagename = pagename:match("^([%l-]+)%-.*sortkey$")
local categories = Array() local codeInPagenameInList = false if codeInPagename then if languageObjects[1] and subpage ~= "documentation" then local agreement = languageObjects[2] and "s" or "" categories:insert("[[Category:Sortkey-generating modules used by " .. #languageObjects .. " language" .. agreement .. "]]") end
languageObjects = Array(languageObjects) :filter( function (lang) local result = lang:getCode() ~= codeInPagename codeInPagenameInList = codeInPagenameInList or result return result end) end
if subpage ~= "documentation" then for script_code in pagename:gmatch("%f[^-%z]%u%l%l%l%f[-]") do local script = require "Module:scripts".getByCode(script_code) if script then categories:insert("") end end end
if subpage ~= "documentation" and not page_exists("Module:" .. pagename .. "/testcases") then categories:insert("") end
if not languageObjects[1] then return categories:concat() end
local langs = Array(languageObjects) :sort( function(lang1, lang2) return lang1:getCode() < lang2:getCode() end) -- This will not error because languageObjects is not empty. :map(languageObjects[1].makeCategoryLink) :serial_comma_join()
return "It is " .. ( codeInPagenameInList and "also" or "" ) .. " used to sort " .. langs .. "." .. categories:concat() end
return export
local m_scriptutils = require("Module:script utilities")
local date_validation = require("Module:Quotations/date validation")
local loadModule -- a forward declaration
local export = {}
local LanguageModule = {}
LanguageModule.__index = LanguageModule
local hasData = {
['ae'] = true,
['ar'] = true,
['axm'] = true,
['az'] = true,
['bra'] = true,
['chg'] = true,
['cy'] = true,
['egy'] = true,
['en'] = true,
['fa'] = true,
['fro'] = true,
['gmq-ogt'] = true,
['gmq-pro'] = true,
['grc'] = true,
['he'] = true,
['hi'] = true,
['hy'] = true,
['inc-ogu'] = true,
['inc-mgu'] = true,
['inc-ohi'] = true,
['inc-opa'] = true,
['inc-pra'] = true,
['la'] = true,
['lzz'] = true,
['mt'] = true,
['mxi'] = true,
['oge'] = true,
['omr'] = true,
['ota'] = true,
['peo'] = true,
['pmh'] = true,
['sa'] = true,
['scn'] = true,
['sv'] = true,
['vah'] = true,
['xcl'] = true,
}
export.hasData = hasData
function export.create(frame)
local passed, results = pcall(function () return export.Create(frame:getParent().args) end)
if passed then
return results
else
--[[Special:WhatLinksHere/Template:tracking/Quotations/error]]
require('Module:debug').track('Quotations/error')
return '<span class="wiktQuote previewonly error" data-validation="red">'..results..'</span>'
end
end
local function warn_about_unrecognized_args(unrecognized_args)
require('Module:debug').track('Quotations/param error')
mw.addWarning('Unrecognized parameters in '
.. mw.text.nowiki('{{Q}}: '
.. table.concat(require('Module:table').keysToList(unrecognized_args), ', ')))
end
function export.Create(args)
-- Set up our initial variables; set empty parameters to false
local processed_args = {}
local unrecognized_args = {}
local params = {
['thru'] = true,
['quote'] = true,
['trans'] = true,
['transauthor'] = true,
['transyear'] = true,
['t'] = true,
['lit'] = true,
['style'] = true,
['object'] = true,
['notes'] = true,
['refn'] = true,
['form'] = true,
['year'] = true,
['termlang'] = true,
['tr'] = true, -- This is simply ignored if quote is in Latin script.
['ts'] = true, -- This is simply ignored if quote is in Latin script.
['subst'] = true, -- This is simply ignored if quote is in Latin script.
['nocat'] = true,
}
local max_numbered_param = 4
for k, v in pairs(args) do
if type(k) == 'number' then
if k > max_numbered_param then
max_numbered_param = k
end
elseif not params[k] then
unrecognized_args[k] = v
end
if v == '' then
if k == "lang" then
processed_args[k] = nil
else
processed_args[k] = false
end
else
processed_args[k] = v
end
end
if next(unrecognized_args) then
warn_about_unrecognized_args(unrecognized_args)
end
-- Ensure that all numbered parameters up to the greatest numbered parameter
-- are not nil.
for i = 1, max_numbered_param do
processed_args[i] = processed_args[i] or false
end
args = processed_args -- Overwrite original args.
local lang = args[1]
lang = require("Module:languages").getByCode(lang) or require("Module:languages").err(lang, 1)
local ante = {}
if hasData[lang:getCode()] then
local m_langModule = LanguageModule.new(lang)
ante = m_langModule:expand(args)
else
require("Module:debug").track {
'Quotations/no data',
'Quotations/no data/' .. lang:getCode(),
}
end
if ante.author == nil then
ante.author = args[2]
end
if ante.work == nil then
ante.work = args[3]
end
if ante.ref == nil then
local ref = {}
for i = 4, 10 do
if args[i] then
table.insert(ref, args[i])
else
break
end
end
ante.ref = table.concat(ref, '.')
end
for k,v in pairs(args) do
if type(k) ~= 'number' then
ante[k] = args[k]
end
end
local penult = {['year'] = '', ['author'] = '', ['work'] = '', ['object'] = '', ['ref'] = '', ['termlang'] = '',
['notes'] = '', ['refn'] = '', ['otherLines'] = {}, ['s1'] = '', ['s2'] = '',
['s3'] = '', ['s4'] = '', ['s5'] = '', ['style1'] = '', ['style2'] = ''}
local comma = false
--Language specific modules are responsible for first line parameters.
--Base formatting module will poll for other parameters,
--pulling them only if the language module hasn't returned them.
local otherOtherLineStuff = {'quote', 'transyear', 'transauthor', 'trans', 'termlang'}
for _, item in ipairs(otherOtherLineStuff) do
ante[item] = ante[item] or args[item]
end
if not ante.code then
penult.elAttr = ' class="wiktQuote" data-validation="white">'
else
penult.elAttr = ' class="wiktQuote" data-validation="'..ante.code..'">'
end
if ante.year then
penult.year = "'''"..date_validation.main(ante.year).."'''"
comma = true
end
if ante.author then
penult.s1 = (comma and ', ' or '')
penult.author = ante.author
comma = true
end
if ante.work then
penult.s2 = (comma and ', ' or '')
penult.work = ante.work
comma = true
end
if ante.object then
penult.s5 = (comma and ' ' or '')
penult.object = '('..ante.object..')'
comma = true
end
if ante.ref then
penult.s3 = (comma and ' ' or '')
penult.ref = ante.ref
end
if ante.style == 'no' or penult.work == '' then
penult.style1 = ''
penult.style2 = ''
elseif ante.style == 'q' then
penult.style1 = '“'
penult.style2 = '”'
else
penult.style1 = "''"
penult.style2 = "''"
end
if ante.termlang then
ante.termlang = require("Module:languages").getByCode(ante.termlang) or require("Module:languages").err(ante.termlang, 1)
penult.termlang = ' (in '..lang:getCanonicalName()..')'
end
local form = args['form'] or 'full'
local ultimate
if form == 'full' then
local categories = {}
local namespace = mw.title.getCurrentTitle().nsText
if ante.notes then
penult.s4 = (comma and ', ' or '')
penult.notes = '('..ante.notes..')'
end
if ante.refn then
penult.refn = ante.refn
end
if ante.t then
ante.trans = ante.t
end
if ante.quote or (ante.trans and ante.trans ~= "-") then
penult.refn = ":" .. penult.refn
local translitwithtrans = false
table.insert(penult.otherLines, "<dl><dd>")
if ante.quote then
local sc = lang:findBestScript(ante.quote)
local quote = ante.quote
-- fix up links with accents/macrons/etc.
if quote:find("[[", 1, true) then
quote = require("Module:links").language_link({term = quote, lang = lang}, false)
end
table.insert(penult.otherLines, m_scriptutils.tag_text(quote, lang, sc, nil, "e-quotation"))
if (namespace == "" or namespace == "Reconstruction") and not args.nocat then
if ante.termlang then
table.insert(categories, ante.termlang:getCanonicalName() .. " terms with quotations")
else
table.insert(categories, lang:getCanonicalName() .. " terms with quotations")
end
end
if not m_scriptutils.is_Latin_script(sc) or lang:getCode() == "egy" then
-- Handle subst=
local subbed_quote = require("Module:links").remove_links(quote)
if args.subst then
local substs = mw.text.split(args.subst, ",")
for _, subpair in ipairs(substs) do
local subsplit = mw.text.split(subpair, mw.ustring.find(subpair, "//") and "//" or "/")
subbed_quote = mw.ustring.gsub(subbed_quote, subsplit[1], subsplit[2])
end
end
local transliteration = args.tr or (lang:transliterate(subbed_quote, sc))
if transliteration then
transliteration = "<dd>" .. m_scriptutils.tag_translit(transliteration, lang, "usex") .. "</dd>"
end
local transcription = args.ts and "<dd>/" .. m_scriptutils.tag_transcription(args.ts, lang, "usex") .. "/</dd>"
if transliteration or transcription then
local translitend = "</dl>"
if ante.trans and ante.trans ~= "-" and not ante.transyear and not ante.transauthor then
translitwithtrans = true
translitend = ""
end
table.insert(penult.otherLines, "<dl>" .. (transliteration or "") .. (transcription or "") .. translitend)
end
end
end
if ante.trans == "-" then
ante.trans = nil
table.insert(categories, "Omitted translation in the main namespace")
elseif ante.trans then
local litline = ""
if ante.lit then
litline = "<dd>(literally, “"..ante.lit.."”)</dd>"
end
if ante.transyear or ante.transauthor then
table.insert(penult.otherLines, "<ul><li>")
if ante.transyear then
table.insert(penult.otherLines, "'''" .. ante.transyear .. "''' translation")
else
table.insert(penult.otherLines, "Translation")
end
if ante.transauthor then
table.insert(penult.otherLines, " by " .. ante.transauthor)
end
table.insert(penult.otherLines, "<dl><dd>" .. ante.trans .. "</dd>" .. litline .. "</dl></li></ul>")
else
if not ante.quote then
table.insert(penult.otherLines, ante.trans)
else
local transstart = "<dl><dd>"
if translitwithtrans then
transstart = "<dd>"
end
table.insert(penult.otherLines, transstart .. ante.trans .. "</dd>" .. litline .. "</dl>")
end
end
elseif lang:getCode() ~= "en" and lang:getCode() ~= "und" then
-- add trreq category if translation is unspecified and language is not English or undetermined
table.insert(categories, "Requests for translations of " .. lang:getCanonicalName() .. " quotations")
end
table.insert(penult.otherLines, "</dd></dl>")
end
penult.otherLines = table.concat(penult.otherLines)
ultimate = '<div'..penult.elAttr..penult.year..penult.s1..penult.author..penult.s2..penult.style1..penult.work..penult.termlang..penult.style2..penult.s5..penult.object..penult.s3..penult.ref..penult.s4..penult.notes..penult.refn..penult.otherLines..'</div>'..require("Module:utilities").format_categories(categories, lang)
elseif form == 'inline' then
ultimate = '<span'..penult.elAttr..penult.author..penult.s2..penult.style1..penult.work..penult.termlang..penult.style2..penult.s5..penult.object..penult.s3..penult.ref..'</span>'
elseif form == 'work' then
ultimate = '<span'..penult.elAttr..penult.style1..penult.work..penult.termlang..penult.style2..penult.s5..penult.object..penult.s3..penult.ref..'</span>'
elseif form == 'ref' then
ultimate = '<span'..penult.elAttr..penult.ref..'</span>'
end
return ultimate
end
local function add_self(func)
return function(self, ...)
return func(...)
end
end
function LanguageModule.new(lang)
local sema = require('Module:Quotations/' .. lang:getCode())
sema.library = mw.loadData("Module:Quotations/" .. lang:getCode() .. "/data")
setmetatable(sema, LanguageModule)
-- Have to insert unused self parameter or Lua–PHP interface complains about
-- table with boolean keys.
sema.lower = add_self(mw.ustring.lower)
sema.period = '.'
return sema
end
setmetatable(LanguageModule, { __index = function (self, key)
if key == 'numToIndian' then
-- This should only be loaded if needed so that [[Module:foreign numerals]]
-- is not transcluded on every page that [[Module:Quotations]] is.
local func = require('Module:foreign numerals').to_Indian
self.numToIndian = func
return func
end
end })
function LanguageModule:changeCode(color)
if color == 'orange' then
self.code = 'orange'
end
if (color == 'yellow') and (self.code == 'green') then
self.code = 'yellow'
end
end
function LanguageModule:reroute(route)
local temp = {}
local data = self.library.data
for k, v in pairs(route) do
temp[k] = self:interpret(v)
end
for k, v in pairs(temp) do
self[k] = v
end
if self.author ~= nil and data[self.author] then
self.aData = data[self.author]
if self.work ~= nil and self.aData.works[self.work] then
self.wData = self.aData.works[self.work]
end
end
end
function LanguageModule:choose(choice, optionA, optionB)
optionB = optionB or ''
choice = self:interpret(choice)
local chosenPath = {}
if choice then
chosenPath = optionA
else
chosenPath = optionB
end
for j=1, 30 do
local innerCurrent = chosenPath[j]
if innerCurrent then
table.insert(self.refLink, self:interpret(current))
else
break
end
end
local ongoingDecision
decision = self:interpret(decision)
return decision
end
function LanguageModule:isLetter(input)
local isit = not tonumber(input)
return isit
end
function LanguageModule:digits(width, num)
local decimal = '%' .. width .. 'd'
return string.format(decimal, num)
end
function LanguageModule:separ(values, separator)
return table.concat(values, separator)
end
function LanguageModule:roundDown(period, verse)
if not tonumber(verse) then
self:changeCode('orange')
else
local rounded = math.floor(verse/period) * period
return rounded
end
end
function LanguageModule:chapterSelect(rubric, verse)
verse = tonumber(verse)
for k,v in pairs(rubric) do
if v[1] <= verse and verse <= v[2] then
return k
end
end
self:changeCode('orange')
end
function LanguageModule:interpret(item)
local output
if type(item) == 'string' then
if string.len(item) > 1 and string.sub(item, 1, 1) == '.' then
local address = string.sub(item, 2)
local returnable = self[address] or self.library.data.Sundry and self.library.data.Sundry[address]
output = returnable
else
output = item
end
elseif type(item) == 'table' then
--If it's a table, it's either a function call or a nested address.
local presumedFunction = self:interpret(item[1])
if type(presumedFunction) == 'function' then
local parameters = {}
for i = 2, 30 do
if item[i] ~= nil then
table.insert(parameters, self:interpret(item[i]))
else
break
end
end
output = presumedFunction(self, unpack(parameters))
else
local nested = self
for i = 1, 30 do
local address = item[i]
if address and nested then
nested = nested[address]
else
break
end
end
output = nested
end
else
output = item
end
return output
end
function LanguageModule:convert(scheme, initiate)
if type(scheme) == "table" then
local initiate = tonumber(initiate) or initiate
local converted = scheme[initiate]
if converted == nil then
self:changeCode('orange')
end
return converted
end
if type(scheme) == "function" then
local initiate = tonumber(initiate) or initiate
local converted = scheme(initiate)
if converted == nil then
self:changeCode('orange')
end
return converted
end
self:changeCode('orange')
end
function LanguageModule:numToRoman(item)
local j = tonumber(item)
if (j == nil) then
return item
end
if (j <= 0) then
return item
end
local ints = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}
local nums = {'M', 'CM', 'D', 'CD','C', 'XC','L','XL','X','IX','V','IV','I'}
local result = ""
for k = 1, #ints do
local count = math.floor(j / ints[k])
result = result .. string.rep(nums[k], count)
j = j - ints[k]*count
end
return result
end
-- Iterate through "array" and its sublevels. Find indices in "array" that
-- contain a string matching "valToFind". Return last index where that string
-- (minus its first letter) is the key for a field in "self", as well as last
-- index where that string was found.
-- Used to locate the place where the "rlformat" should be skipped out of,
-- because there's no ".ref" value supplied for what comes next.
-- For instance, if book but not line number has been supplied.
local function findLastValidRefIndex(self, array, valToFind)
local lastValidIndex, lastIndex
for i, val in ipairs(array) do
if type(val) == 'table' then
local res1, res2 = findLastValidRefIndex(self, val, valToFind)
if res1 then
lastValidIndex = i
end
if res2 then
lastIndex = i
end
elseif type(val) == 'string' and val:find(valToFind) then
lastIndex = i
if self[val:sub(2)] then
lastValidIndex = i
end
end
end
return lastValidIndex, lastIndex
end
function LanguageModule:expand(args)
--Instantiate our variables.
local results = {}
self.code = 'green'
local data = self.library.data
local ultimate = ''
self.author = args['author'] or args[2]
self.work = args['work'] or args[3]
for i = 1, 5 do
local refName = 'ref' .. i
local paramNumber = i + 3
self[refName] = args[refName] or args[paramNumber]
end
--Check if we've been given an author alias.
if data.authorAliases[self.author] then
self.author = data.authorAliases[self.author]
end
if not data[self.author] then
self:changeCode('yellow')
else
self.aData = data[self.author]
if self.aData.reroute then
self:reroute(self.aData.reroute)
else
if self.aData.aliases and self.aData.aliases[self.work] then
self.work = self.aData.aliases[self.work]
end
if not (self.aData.works and self.aData.works[self.work]) then
self:changeCode('yellow')
else
self.wData = self.aData.works[self.work]
if self.wData.reroute then
self:reroute(self.wData.reroute)
end
end
end
end
--Load all author-level data.
if self.aData and self.aData.aLink then
results.author = '[[w:'..self.aData.aLink..'|'..self.author..']]'
else
results.author = self.author
end
if self.aData and self.aData.year then
results.year = self.aData.year
end
--If the database has a link for the work, incorporate it.
if not self.wData or not self.wData['wLink'] then
results.work = self.work
else
results.work = '[[w:'..self.wData['wLink']..'|'..self.work..']]'
end
--Some works have info which overrides the author-level info or fills other parameters.
if self.wData then
if self.wData['year'] then
results.year = self.wData.year
end
if self.wData['author'] ~= nil then
results.author = self.wData.author
end
if self.wData['object'] then
results.object = self.wData.object
end
if self.wData['style'] then
results.style = self.wData.style
end
end
--The displayed reference usually consists of all the ref argument(s) joined with a period.
self.refDisplay = self.ref1 and '' or (self.wData and self.wData['refDefaultDisplay'] or false)
local separator_num = 1
for i = 1, 5 do
local whichRef = 'ref' .. tostring(i)
if self[whichRef] then
local ref = self[whichRef]
local separator
-- no separator before a letter
if mw.ustring.match(ref, "^%a$") then
separator = ""
-- to allow colon between biblical chapter and verse
elseif self.aData and self.aData.rdFormat and self.aData.rdFormat.separator then
separator = self.aData.rdFormat.separator
elseif self.aData and self.aData.rdFormat and self.aData.rdFormat.separators then
separator = self.aData.rdFormat.separators[separator_num]
else
separator = "."
end
if i > 1 then
self.refDisplay = self.refDisplay .. separator
separator_num = separator_num + 1
end
self.refDisplay = self.refDisplay .. self[whichRef]
else
break
end
end
if args['through'] then
args['thru'] = args['through']
end
if args['thru'] then
self.refDisplay = self.refDisplay..'–'..args['thru']
end
--[[ If the work is not in the database,
or we don't have a source text link,
the ref is simply the display.
Otherwise, we have to create a reference link,
easily the most challenging function of this script. ]]
if self.wData and self.wData['rlFormat'] then
self.rlFormat = self.aData['rlFormat'..tostring(self.wData.rlFormat)]
if self.rlFormat then
self.rlTitle = self.wData['rlTitle']
-- Go through indices in "self.rlFormat" that contain a string
-- beginning in ".ref" (either in the first level of "self.rlFormat"
-- or a sublevel). Return the index of the string that has a
-- corresponding field in "self", as well as the index of the last
-- such string.
local lastValidIndex, lastIndex = findLastValidRefIndex(self, self.rlFormat, '^%.ref(%d+)$')
-- If there isn't another ".ref" string after the last valid index,
-- then there is no need to cut short the rlFormat.
local indexToStopAt
if lastIndex and lastValidIndex and lastIndex > lastValidIndex then
indexToStopAt = lastValidIndex
else
indexToStopAt = math.huge
end
self.refLink = {}
for i, current in ipairs(self.rlFormat) do
if i > indexToStopAt then
break
end
table.insert(self.refLink, self:interpret(current))
end
self.refLink = table.concat(self.refLink)
end
end
if self.wData and self.wData['xrlFormat'] then
self.xrlFormat = self.aData['xrlFormat'..tostring(self.wData.xrlFormat)]
if self.xrlFormat then
self.xurl = self.wData['xurl']
-- Go through indices in "self.xrlFormat" that contain a string
-- beginning in ".ref" (either in the first level of "self.xrlFormat"
-- or a sublevel). Return the index of the string that has a
-- corresponding field in "self", as well as the index of the last
-- such string.
local lastValidIndex, lastIndex = findLastValidRefIndex(self, self.xrlFormat, '^%.ref(%d+)$')
-- If there isn't another ".ref" string after the last valid index,
-- then there is no need to cut short the rlFormat.
local indexToStopAt
if lastIndex and lastValidIndex and lastIndex > lastValidIndex then
indexToStopAt = lastValidIndex
else
indexToStopAt = math.huge
end
self.xrefLink = {}
for i, current in ipairs(self.xrlFormat) do
if i > indexToStopAt then
break
end
table.insert(self.xrefLink, self:interpret(current))
end
self.xrefLink = table.concat(self.xrefLink)
end
end
if self.refLink and self.refDisplay then
results.ref = '[['..self.refLink..'|'..self.refDisplay..']]'
elseif self.xrefLink and self.refDisplay then
results.ref = '['..self.xrefLink..' '..self.refDisplay..']'
else
results.ref = self.refDisplay or ''
end
if args['notes'] then
results.notes = args.notes
end
results.code = self.code
return results
end
return export
- Pages using deprecated enclose attributes
- Pages with script errors
- Uncategorized modules
- " .. cat .. "
- Transliteration modules without a testcases subpage
- Erutuon's test category
- " .. script:getCategoryName() .. "
- Entry name-generating modules without a testcases subpage
- Sortkey-generating modules without a testcases subpage