Volatile:ListField
From Metabolomics.JP
(Difference between revisions)
Line 1: | Line 1: | ||
<!----List fields of name "<nowiki>{{{1|}}}</nowiki>" in namespace "<nowiki>{{{2}}}</nowiki>".---->{{#lua: | <!----List fields of name "<nowiki>{{{1|}}}</nowiki>" in namespace "<nowiki>{{{2}}}</nowiki>".---->{{#lua: | ||
+ | function trim(s) return (string.gsub(s, "^%s*(.-)%s*$", "%1")) end | ||
list = {} | list = {} | ||
id = {} | id = {} | ||
− | for page,data in stdin:gmatch("&&([%S]+)&&{{{1}}}= *([^\n]+) | + | for page,data in stdin:gmatch("&&([%S]+)&&{{{1}}}= *([^\n]+)") do |
if ((data ~= "-") and (data ~= " ")) then | if ((data ~= "-") and (data ~= " ")) then | ||
− | data = | + | data = trim(data) |
tmp = list[data] | tmp = list[data] | ||
if (tmp == nil) then | if (tmp == nil) then |