Module:MOS intro: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
local p = {}
local et = require("Module:ET")
local mos = require("Module:MOS")
local mos = require("Module:MOS")
local rat = require("Module:Rational")
local rat = require("Module:Rational")
local tamnams = require("Module:TAMNAMS")
local tip = require("Module:Template input parse")
local utils = require("Module:Utils")
local utils = require("Module:Utils")
local et = require("Module:ET")
local tip = require("Module:Template input parse")
local tamnams = require("Module:TAMNAMS")
local yesno = require("Module:Yesno")
local yesno = require("Module:Yesno")
local p = {}
 
-- TODO:
-- - Possible cleanup/rewording
-- - Possible official deprecation of other names; focus should be on what a mos
--  is, not what it's called.


-- Helper function
-- Helper function
Line 196: Line 202:
function p._mos_intro(input_mos, other_names)
function p._mos_intro(input_mos, other_names)
local input_mos = input_mos or mos.new(5, 5, 3)
local input_mos = input_mos or mos.new(5, 5, 3)
local other_names = other_names or ""
local other_names = ""
-- Scale sig
-- Scale sig
Line 277: Line 283:
local dark_gen_max_r = tostring(utils._round_dec(dark_gen_max, round))
local dark_gen_max_r = tostring(utils._round_dec(dark_gen_max, round))
intro = intro .. string.format(" [[generator|Generators]] that produce this scale range from %s{{cent}} to %s{{cent}}, or from %s{{cent}} to %s{{cent}}.", bright_gen_min_r, bright_gen_max_r, dark_gen_min_r, dark_gen_max_r)
intro = intro .. string.format(" [[Generator]]s that produce this scale range from %s{{cent}} to %s{{cent}}, or from %s{{cent}} to %s{{cent}}.", bright_gen_min_r, bright_gen_max_r, dark_gen_min_r, dark_gen_max_r)
-- Rothenberg propriety (rothenprop) info
-- Rothenberg propriety (rothenprop) info
Line 287: Line 293:
return intro
return intro
end
end


Line 296: Line 301:
local other_names = frame.args["Other Names"] or ""
local other_names = frame.args["Other Names"] or ""
local depparams = other_names ~= "" and " [[Category:Pages with deprecated parameters]]" or ""
local depparams = (other_names ~= "" and " [[Category:Pages with deprecated parameters]]" or "")
     local result = p._mos_intro(input_mos, other_names) .. depparams
     local result = p._mos_intro(input_mos, other_names) .. depparams
     local debugg = yesno(frame.args["debug"])
     local debugg = yesno(frame.args["debug"])
     return frame:preprocess(debugg == true and "<pre>" .. result .. "</pre>" or result)
      
    -- Debugger option
    if debugg == true then
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
end
return frame:preprocess(result)
end
end


return p
return p