Module:Sandbox/User:Alsang: Difference between revisions

From Brighter Shores Wiki
Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
Line 3: Line 3:
function p.main()
function p.main()
local query = '[[Category:Hammermage Equipment]] OR [[Category:Guardian Equipment]] OR [[Category:Cryoknight Equipment]]|?#-=name|limit=500'
local query = '[[Category:Hammermage Equipment]] AND [[Variant type::~*]]|?#-=name|limit=500'
local results = mw.smw.ask(query)
local results = mw.smw.ask(query)
local out = mw.html.create('table')
local out = mw.html.create('table')
:addClass('wikitable sortable')
for _,page in ipairs(results) do
for _,page in ipairs(results) do
out:wikitext(page.name)
out:tag('tr')
:tag('th')
out:wikitext(mw.getCurrentFrame():preprocess('{{ItemSources|' .. page.name .. '}}'))
:wikitext('[[' .. page.name .. ']]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (basic)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (moderate)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (fine)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (strong)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (superior)]]')
:done()
:tag('td')
:wikitext('[[' .. page.name .. ' (perfect)]]')
:done()
:done()
end
end

Revision as of 09:49, 30 December 2024

Module documentation
This documentation is transcluded from Module:Sandbox/User:Alsang/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:Sandbox/User:Alsang/doc. [edit]
Module:Sandbox/User:Alsang's function main is invoked by Template:Sandbox/User:Alsang.

p = {}

function p.main()
	
	local query = '[[Category:Hammermage Equipment]] AND [[Variant type::~*]]|?#-=name|limit=500'
	local results = mw.smw.ask(query)
	
	
	local out = mw.html.create('table')
		:addClass('wikitable sortable')
	for _,page in ipairs(results) do
		out:tag('tr')
			:tag('th')
				:wikitext('[[' .. page.name .. ']]')
			:done()
			:tag('td')
				:wikitext('[[' .. page.name .. ' (basic)]]')
			:done()
			:tag('td')
				:wikitext('[[' .. page.name .. ' (moderate)]]')
			:done()
			:tag('td')
				:wikitext('[[' .. page.name .. ' (fine)]]')
			:done()
			:tag('td')
				:wikitext('[[' .. page.name .. ' (strong)]]')
			:done()
			:tag('td')
				:wikitext('[[' .. page.name .. ' (superior)]]')
			:done()
			:tag('td')
				:wikitext('[[' .. page.name .. ' (perfect)]]')
			:done()
		:done()
	end
	
	return out
	
end

return p