Module:EFloras/documentation functions
MyWikiBiz, Author Your Legacy — Wednesday December 04, 2024
Jump to navigationJump to searchlocal p = {} local output_mt = {} function output_mt:insert(str) self.n = self.n + 1 self[self.n] = str end -- also in [[Module:Unicode data/documentation functions]] function output_mt:insert_format(...) self:insert(string.format(...)) end output_mt.join = table.concat output_mt.__index = output_mt local function Output() return setmetatable({ n = 0 }, output_mt) end function p.show_resources(frame) local output = Output() output:insert [[ {| id="eFloras-resources" class="wikitable" style="float: right;" ! code !! style="width: 22em;" | title]] for str_number, resource_name in require "Module:TableTools".sortedPairs( require "Module:eFloras/data".resources, function (str_number1, str_number2) return tonumber(str_number1) < tonumber (str_number2) end) do output:insert_format("|-\n| <code>%s</code> || %s", str_number, resource_name) end output:insert("|}") return output:join("\n") end return p