Module:Template input parse: Difference between revisions
Bugfix with parsing kv-pairs |
Abandoned code that would return nil if the resulting tables were size zero |
||
Line 88: | Line 88: | ||
table.insert(pairs_, pair) | table.insert(pairs_, pair) | ||
end | end | ||
end | end | ||
end | end | ||
Line 104: | Line 99: | ||
-- Then tokenize the tokens into key-value pairs | -- Then tokenize the tokens into key-value pairs | ||
local pairs_ = {} | local pairs_ = {} | ||
local num_pairs = 0 | --local num_pairs = 0 | ||
for i = 1, #parsed do | for i = 1, #parsed do | ||
local pair = p.parse_pair(parsed[i]) | local pair = p.parse_pair(parsed[i]) | ||
if pair ~= nil and #pair == 2 then | if pair ~= nil and #pair == 2 then | ||
pairs_[pair[1]] = pair[2] | pairs_[pair[1]] = pair[2] | ||
num_pairs = num_pairs + 1 | --num_pairs = num_pairs + 1 | ||
end | end | ||
end | end | ||
end | end | ||
return p | return p |