Module:number list: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 186: Line 186:
local args = require("Module:parameters").process(frame:getParent().args, params)
local args = require("Module:parameters").process(frame:getParent().args, params)
local lang = args[1] or "und"
local cur_num = args[1] or 1
local cur_num = args[2] or 2
local cur_type = args.type
local cur_type = args.type
if not (type(cur_num) == "number" or cur_num:find "^%d+$") then
if not (type(cur_num) == "number" or cur_num:find "^%d+$") then
error("Extraneous characters in parameter 2: should be decimal number (integer).")
error("Extraneous characters in parameter 2: should be decimal number (integer).")
end
end
local alt_pagename = args[3] or false
local alt_pagename = args[2] or false
local remove_suffix = args[4] or false
local remove_suffix = args[3] or false
lang = require("Module:languages").getByCode(lang) or error("The language code \"" .. lang .. "\" is not valid.")
-- Get the data from the data module.
-- Get the data from the data module.
Line 454: Line 452:
end
end
local lang = args[1] or (mw.title.getCurrentTitle().nsText == "Template" and "und") or error("Language code has not been specified. Please pass parameter 1 to the template.")
local sc = args["sc"];  
local sc = args["sc"];  
local headlink = args["headlink"]
local headlink = args["headlink"]
Line 461: Line 458:
local tr = args["tr"]
local tr = args["tr"]
local prev_symbol = if_not_empty(args[2])
local prev_symbol = if_not_empty(args[1])
local cur_symbol = if_not_empty(args[3]);
local cur_symbol = if_not_empty(args[2]);
local next_symbol = if_not_empty(args[4])
local next_symbol = if_not_empty(args[3])
local prev_term = if_not_empty(args[5])
local prev_term = if_not_empty(args[4])
local next_term = if_not_empty(args[6])
local next_term = if_not_empty(args[5])


local cardinal_term = args["card"]; local cardinal_alt = args["cardalt"]; local cardinal_tr = args["cardtr"]
local cardinal_term = args["card"]; local cardinal_alt = args["cardalt"]; local cardinal_tr = args["cardtr"]
Line 489: Line 486:


lang = require("Module:languages").getByCode(lang) or error("The language code \"" .. lang .. "\" is not valid.")
sc = (sc and (require("Module:scripts").getByCode(sc) or error("The script code \"" .. sc .. "\" is not valid.")) or nil)
sc = (sc and (require("Module:scripts").getByCode(sc) or error("The script code \"" .. sc .. "\" is not valid.")) or nil)