Module:SB tree: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
local p = {}
local p = {}
local yesno = require("Module:Yesno")


-- Function that constructs a sequence of ratios according to the Stern-Brocot tree
-- Function that constructs a sequence of ratios according to the Stern-Brocot tree
Line 136: Line 138:
-- Create the table
-- Create the table
result = "{| class=\"wikitable\"\n"
result = "{| class=\"wikitable\"\n|-\n"
.. "! "
.. "! "
-- Create the header cell
-- Create the header cell
if stagger_ratios then
if stagger_ratios then
result = result .. "colspan=\"" .. depth + edge_extend + 1 .. " | "
result = result .. "colspan=\"" .. depth + edge_extend + 1 .. "\" | "
end
end
result = result .. "Ratios\n"
result = result .. "Ratios\n"
Line 166: Line 168:
result = result .. "|}"
result = result .. "|}"
return result
-- Debugger option
local debugg = yesno(frame.args["debug"])
if debugg == true then
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
end
return frame:preprocess(result)
end
end


return p
return p