Module:number list: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 11: Line 11:
local sort = table.sort
local sort = table.sort
local u = m_str_utils.char
local u = m_str_utils.char
local unpack = unpack or table.unpack -- Lua 5.2 compatibility
local upper = string.upper
local upper = string.upper


Line 33: Line 34:


local default_form_types = {
local default_form_types = {
{key = "cardinal", display = "[[wikt:cardinal number|Cardinal]]"},
{key = "cardinal", display = "[[w:cardinal number|Cardinal]]"},
{key = "ordinal", display = "[[wikt:ordinal number|Ordinal]]"},
{key = "ordinal", display = "[[w:ordinal number|Ordinal]]"},
{key = "ordinal_abbr", display = "[[wikt:ordinal number|Ordinal]] [[wikt:abbreviation]]"},
{key = "ordinal_abbr", display = "[[w:ordinal number|Ordinal]] [[w:abbreviation]]"},
{key = "adverbial", display = "[[wikt:adverbial number|Adverbial]]"},
{key = "adverbial", display = "[[w:adverbial number|Adverbial]]"},
{key = "multiplier", display = "[[wikt:multiplier|Multiplier]]"},
{key = "multiplier", display = "[[w:multiplier|Multiplier]]"},
{key = "distributive", display = "[[wikt:distributive number|Distributive]]"},
{key = "distributive", display = "[[w:distributive number|Distributive]]"},
{key = "collective", display = "[[wikt:collective number|Collective]]"},
{key = "collective", display = "[[w:collective number|Collective]]"},
{key = "fractional", display = "[[wikt:fractional|Fractional]]"},
{key = "fractional", display = "[[w:fractional|Fractional]]"},
}
}


Line 54: Line 55:
lower = true,
lower = true,
}
}
local function track(page)
require("Module:debug/track")("number list/" .. page)
return true
end


--[=[
--[=[
Line 134: Line 130:
retval.tag = {content}
retval.tag = {content}
end
end
elseif prefix == "q" or prefix == "qq" or prefix == "tr" or prefix == "link" or prefix == "id" or prefix == "alt" then
elseif prefix == "q" or prefix == "qq" or prefix == "tr" or prefix == "link" or prefix == "id" then
if retval[prefix] then
if retval[prefix] then
error(("Duplicate modifier '%s' in data module form, already saw value '%s': %s"):format(prefix,
error(("Duplicate modifier '%s' in data module form, already saw value '%s': %s"):format(prefix,
Line 479: Line 475:
local left_q = formobj.q and require("Module:qualifier").format_qualifier(formobj.q) .. " " or ""
local left_q = formobj.q and require("Module:qualifier").format_qualifier(formobj.q) .. " " or ""
local right_q = formobj.qq and " " .. require("Module:qualifier").format_qualifier(formobj.qq) or ""
local right_q = formobj.qq and " " .. require("Module:qualifier").format_qualifier(formobj.qq) or ""
local term = maybe_unaffix(m_data, formobj.form)
local alt = nil
if term ~= formobj.form then alt = formobj.form end
return left_q .. m_links.full_link{
return left_q .. m_links.full_link{
lang = lang, term = maybe_unaffix(m_data, formobj.form), alt = formobj.alt or formobj.form, tr = formobj.tr,
lang = lang, term = term, alt = alt, tr = formobj.tr,
} .. right_q
} .. right_q
end
end
Line 496: Line 495:


local parent_args = frame:getParent().args
local parent_args = frame:getParent().args
if parent_args.pagename then
track("show-box-pagename")
end
local args = require("Module:parameters").process(parent_args, params, nil, "number list", "show_box")
local args = require("Module:parameters").process(parent_args, params, nil, "number list", "show_box")


Line 1,000: Line 996:
local appendix
local appendix
local title
local title
if mw.title.new(appendix1, "Appendix"):getContent() then
appendix = appendix1
elseif mw.title.new(appendix2, "Appendix"):getContent() then
appendix = appendix2
end


if appendix then
if appendix then
Line 1,130: Line 1,131:
local optional2_title = args.opt2
local optional2_title = args.opt2
local optional2_term = args.opt2x; local optional2_alt = args.opt2xalt; local optional2_tr = args.opt2xtr
local optional2_term = args.opt2x; local optional2_alt = args.opt2xalt; local optional2_tr = args.opt2xtr
track(lang:getCode())
if sc then
track("sc")
end
if headlink then
track("headlink")
end
if wplink then
track("wplink")
end
if alt then
track("alt")
end
if cardinal_alt or ordinal_alt or adverbial_alt or multiplier_alt or distributive_alt or collective_alt or fractional_alt or optional1_alt or optional2_alt then
track("xalt")
end


local subpage = mw.title.getCurrentTitle().subpageText
local subpage = mw.title.getCurrentTitle().subpageText
Line 1,179: Line 1,158:


if prev_term or prev_symbol then
if prev_term or prev_symbol then
previous = "[[Contionary:" .. prev_term .. "|" .. " <  " .. prev_symbol .. "]]"
previous = m_links.full_link{lang = lang, sc = sc, term = prev_term, alt = " <  " .. prev_symbol, tr = "-", no_alt_ast = true}
--previous = m_links.full_link{lang = lang, sc = sc, term = prev_term, alt = " <  " .. prev_symbol, tr = "-", no_alt_ast = true}
end
end


local current = "[[Contionary:" .. pagename .. "|" .. pagename .. "]]"
local current = m_links.full_link{lang = lang, sc = sc, alt = cur_symbol, tr = "-", no_alt_ast = true}
--local current = m_links.full_link{lang = lang, sc = sc, alt = cur_symbol, tr = "-", no_alt_ast = true}


local next = ""
local next = ""


if next_term or next_symbol then
if next_term or next_symbol then
next = "[[Contionary:" .. next_term .. "|" .. next_symbol .. "  > ]]"
next = m_links.full_link{lang = lang, sc = sc, term = next_term, alt = next_symbol .. "  > ", tr = "-", no_alt_ast = true}
--next = m_links.full_link{lang = lang, sc = sc, term = next_term, alt = next_symbol .. "  > ", tr = "-", no_alt_ast = true}
end
end


Line 1,196: Line 1,172:


if cardinal_term then
if cardinal_term then
insert(forms, "     ''[[cardinal number|Cardinal]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = cardinal_term, alt = cardinal_alt, tr = cardinal_tr})
insert(forms, "     ''[[wikt:cardinal number|Cardinal]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = cardinal_term, alt = cardinal_alt, tr = cardinal_tr})
end
end


if ordinal_term then
if ordinal_term then
insert(forms, "     ''[[ordinal number|Ordinal]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = ordinal_term, alt = ordinal_alt, tr = ordinal_tr})
insert(forms, "     ''[[wikt:ordinal number|Ordinal]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = ordinal_term, alt = ordinal_alt, tr = ordinal_tr})
end
end


if adverbial_term then
if adverbial_term then
insert(forms, "     ''[[adverbial number|Adverbial]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = adverbial_term, alt = adverbial_alt, tr = adverbial_tr})
insert(forms, "     ''[[wikt:adverbial number|Adverbial]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = adverbial_term, alt = adverbial_alt, tr = adverbial_tr})
end
end


if multiplier_term then
if multiplier_term then
insert(forms, "     ''[[multiplier|Multiplier]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = multiplier_term, alt = multiplier_alt, tr = multiplier_tr})
insert(forms, "     ''[[wikt:multiplier|Multiplier]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = multiplier_term, alt = multiplier_alt, tr = multiplier_tr})
end
end


if distributive_term then
if distributive_term then
insert(forms, "     ''[[distributive number|Distributive]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = distributive_term, alt = distributive_alt, tr = distributive_tr})
insert(forms, "     ''[[wikt:distributive number|Distributive]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = distributive_term, alt = distributive_alt, tr = distributive_tr})
end
end


if collective_term then
if collective_term then
insert(forms, "     ''[[collective number|Collective]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = collective_term, alt = collective_alt, tr = collective_tr})
insert(forms, "     ''[[wikt:collective number|Collective]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = collective_term, alt = collective_alt, tr = collective_tr})
end
end


if fractional_term then
if fractional_term then
insert(forms, "     ''[[fractional|Fractional]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = fractional_term, alt = fractional_alt, tr = fractional_tr})
insert(forms, "     ''[[wikt:fractional|Fractional]]'' : " .. m_links.full_link{lang = lang, sc = sc, term = fractional_term, alt = fractional_alt, tr = fractional_tr})
end
end


Navigation menu