Moduł:Brudnopis/Paweł Ziemian/Tabela władców/dane

Z Wikipedii, wolnej encyklopedii

Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:Brudnopis/Paweł Ziemian/Tabela władców/dane/opis

local data = {}
local group = false
for line in mw.ustring.gmatch(mw.title.new( "Tabele władców", "Wikiprojekt" ):getContent(), "[^\n]+") do
	local h = mw.ustring.match(line, "^==%s*([^=%s].-[^=%s])%s*==$")
	if h then
		if group and group.items then
			table.insert(data, group)
		end

		group = { header = h }
	elseif group then
		local s, e, n = mw.ustring.match(line, "^%s+(%-?[0-9]+)%s+(%-?[0-9]+)%s+(.-)%s*$")
		s = tonumber(s)
		e = tonumber(e)
		if s and e and n then
			if not group.items then
				group.items = {}
			end

			table.insert(group.items, { s, e, n } )
		end
	end
end

return data