Module:Indicator datasets table
Documentation for this module may be created at Module:Indicator datasets table/doc
local p = {}
function p.getDatasets(frame)
local articleids = frame.args.articleids
if not articleids then
return "Error: articleids not provided"
end
local ids = mw.text.split(articleids, ",")
local dates = {}
for _, id in ipairs(ids) do
-- Konstruieren des Seitentitels anhand der Page-ID
local page = mw.title.new('', 3000, tonumber(id))
mw.log('Page title:', page)
local root = mw.html.create('div')
root
:addClass('my-class')
:wikitext('Test')
-- local page = callAssert(mw.title.new, '', tonumber(id))
if page and page.exists then
local content = page:getContent()
local jsonData = mw.text.jsonDecode(content)
if jsonData and jsonData.date then
table.insert(dates, jsonData.date)
else
table.insert(dates, "Error: Datum nicht gefunden für ID " .. id)
end
else
table.insert(dates, "Error: Seite nicht gefunden für ID " .. id)
end
end
return table.concat(dates, ", ")
end
return p