Module:FideRanking


local e = {}

function e.women(frame)
	local womenJsonDataPage = mw.title.makeTitle( 'Template', 'FIDE world rankings/women' )
	
	ret = "<table class='wikitable'>";
    womenJsonData = mw.text.jsonDecode(womenJsonDataPage:getContent());
    
	ret = ret .. "<tr>";
	ret = ret .. "<th>" .. "Rank" .. "</th>";
	ret = ret .. "<th>" .. "Player" .. "</th>";
	ret = ret .. "<th>" .. "Rating" .. "</th>";
	ret = ret .. "</tr>";
	    
	for k, v in ipairs(womenJsonData ) do
		ret = ret .. "<tr>";
	    ret = ret .. "<th>".. v.rank .. "</th>";
	    ret = ret .. "<td>" .. frame:expandTemplate{ title = 'flagicon', args = { v.country } } .. " [[".. v.name .. "]]" .. "</td>";
	    ret = ret .. "<td>".. v.rating .. "</td>";
	    ret = ret .. "</tr>";
	end

	return ret .. "</table>";
end

return e