Module:Scale tree: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
Line 7: Line 7:
local p = {}
local p = {}


-- Helper function that parses entries from a pipe-delimited string and returns them in an array
-- Helper function that parses entries from a semicolon-delimited string and returns them in an array
-- TODO: Separate this and parse_pairs into its own module of helper functions, as they're included
-- TODO: Separate this and parse_pairs into its own module of helper functions, as they're included
-- in various modules at this point
-- in various modules at this point
function p.parse_entries(unparsed)
function p.parse_entries(unparsed)
local parsed = {}
local parsed = {}
-- for entry in string.gmatch(unparsed, "([^;]+)") do
-- for entry in string.gmatch(unparsed, "([^%$]+)") do
for entry in string.gmatch(unparsed, "([^|]+)") do
for entry in string.gmatch(unparsed, "([^|]+)") do
local trimmed = entry:gsub("^%s*(.-)%s*$", "%1")
local trimmed = entry:gsub("^%s*(.-)%s*$", "%1")
Line 195: Line 195:
local depth = frame.args["depth"] or 5
local depth = frame.args["depth"] or 5
local comments_unparsed = frame.args["Comments"] or ""
local comments_unparsed = frame.args["Comments"] or ""
local comments = p.parse_kv_pairs(comments_unparsed:gsub("({{[^{}]+}})", frame:preprocess("%1"))) or {}
local comments = p.parse_kv_pairs(comments_unparsed) or {}
local out_str = p._scale_tree(mos, depth, comments)
local out_str = p._scale_tree(mos, depth, comments)