Modul:Stadtwikis: Unterschied zwischen den Versionen

Aus FürthWiki

Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 3: Zeile 3:


function p.Versuch(frame)
function p.Versuch(frame)
t = getAPIdata("https://www.fuerthwiki.de/wiki/api.php?action=query&meta=siteinfo&siprop=statistics&format=json")
urls = {"https://www.fuerthwiki.de/wiki/api.php",
x='<table class="wikitable sortable"><tr>'..
    "https://oesterreichwiki.org/w/api.php"}
   
h='<table class="wikitable sortable"><tr>'..
'<th>Wiki URL</th>'..
'<th>Artikel</th>'..
'<th>Artikel</th>'..
'<th>Bilder</th>'..
'<th>Bilder</th>'..
Zeile 11: Zeile 14:
'<th>Aktive</th>'..
'<th>Aktive</th>'..
'<th>Admins</th>'..
'<th>Admins</th>'..
tabelizeData(t)..
'</tr>'
'</table>'
return x
for i,url in ipairs(urls) do
t = getAPIdata(url.."?action=query&meta=siteinfo&siprop=statistics&format=json")
h=h..tabelizeData(t)
end
h=h..'</table>'
return h
end
end


--function
function tabelizeData(t)
function tabelizeData(t)
h='<tr>'..
h='<tr>'..

Version vom 12. Mai 2025, 13:26 Uhr

Die Dokumentation für dieses Modul kann unter Modul:Stadtwikis/Doku erstellt werden

local p = {}
local c = require( "Module:Common" )

function p.Versuch(frame)
	urls = {"https://www.fuerthwiki.de/wiki/api.php", 
		    "https://oesterreichwiki.org/w/api.php"}
		    
	h='<table class="wikitable sortable"><tr>'..
		'<th>Wiki URL</th>'..
		'<th>Artikel</th>'..
		'<th>Bilder</th>'..
		'<th>Bearbeitungen</th>'..
		'<th>Benutzer</th>'..
		'<th>Aktive</th>'..
		'<th>Admins</th>'..
	'</tr>'
	
	for i,url in ipairs(urls) do
		t = getAPIdata(url.."?action=query&meta=siteinfo&siprop=statistics&format=json")
		h=h..tabelizeData(t)
	end
	
	h=h..'</table>'
	return h
end

--function 
function tabelizeData(t)
	h='<tr>'..
		'<td>'..t['articles']..'</td>'..
		'<td>'..t['images']..'</td>'..
		'<td>'..t['edits']..'</td>'..
		'<td>'..t['users']..'</td>'..
		'<td>'..t['activeusers']..'</td>'..
		'<td>'..t['admins']..'</td>'..
	'</tr>'
	return h
end

function getAPIdata(url)
	t = mw.ext.externalData.getWebData {url=url}
    return t
end
return p