Module:Stubs: Difference between revisions
From TwogPedia
(Created page with "local getArgs = require('Module:Arguments').getArgs local cargo = mw.ext.cargo local Stubs= {} function Stubs.main(frame) local args = getArgs(frame) local tableContainer = mw.html.create('div') local tables = 'Stubs' local fields = '_pageName, type, comment' local cargoArgs = { orderBy = 'type', limit = 40 } local results = cargo.query(tables, fields, cargoArgs) if #results > 0 then local type = results[1].type tableContainer:node(mw.h...") |
No edit summary |
||
Line 25: | Line 25: | ||
tableContainer:node(mw.html.create('h2'):wikitext(type)) | tableContainer:node(mw.html.create('h2'):wikitext(type)) | ||
end | end | ||
local stub = mw.html.create('div'):wikitext([[result._pageName | local stub = mw.html.create('div'):wikitext('[[' .. result._pageName .. ']] - ' .. result.comment) | ||
tableContainer:node(stub ) | tableContainer:node(stub ) | ||
end | end |
Revision as of 16:14, 14 May 2023
Documentation for this module may be created at Module:Stubs/doc
local getArgs = require('Module:Arguments').getArgs
local cargo = mw.ext.cargo
local Stubs= {}
function Stubs.main(frame)
local args = getArgs(frame)
local tableContainer = mw.html.create('div')
local tables = 'Stubs'
local fields = '_pageName, type, comment'
local cargoArgs = {
orderBy = 'type',
limit = 40
}
local results = cargo.query(tables, fields, cargoArgs)
if #results > 0 then
local type = results[1].type
tableContainer:node(mw.html.create('h2'):wikitext(type))
for i = 1, #results do
local result = results[i]
if result.type ~= type then
tableContainer:node(mw.html.create('h2'):wikitext(type))
end
local stub = mw.html.create('div'):wikitext('[[' .. result._pageName .. ']] - ' .. result.comment)
tableContainer:node(stub )
end
else
return tableContainer:wikitext('No stubs found')
end
return tableContainer
end
return Stubs
No categories