Module:Characters: Difference between revisions

m
no edit summary
No edit summary
mNo edit summary
(3 intermediate revisions by the same user not shown)
Line 7: Line 7:
orderBy = 'Characters.name_en ASC',
orderBy = 'Characters.name_en ASC',
}
}
if frame.args[1] == 'horsegirls' then
query.where = 'Characters.type="horsegirl" AND Characters.media IS NULL'
elseif frame.args[1] == 'other' then
query.where = 'NOT Characters.type="horsegirl" AND Characters.media IS NULL'
elseif frame.args[1] == 'cinderellagray' then
query.where = 'Characters.media="cinderellagray"'
elseif frame.args[1] == 'starblossom' then
query.where = 'Characters.media="starblossom"'
elseif frame.args[1] == 'anime' then
query.where = 'Characters.media="anime"'
end
local fields = {'_pageName','name_en','icon','color_main','color_sub'}
local fields = {'_pageName','name_en','icon','color_main','color_sub'}
local characters = cargo.query('Characters',
local characters = cargo.query('Characters',
Line 13: Line 24:
local root = mw.html.create('div'):cssText('display:flex; flex-flow:row wrap; gap: 10px;')
local root = mw.html.create('div'):cssText('display:flex; flex-flow:row wrap; gap: 10px;')
for _, ch in ipairs(characters) do
for _, ch in ipairs(characters) do
if (ch.icon) then
if ch.icon then
local template = frame:expandTemplate{
local template = frame:expandTemplate{
title='Character Icon',
title='Character Icon',
Line 24: Line 35:
}
}
}
}
root:wikitext(template)
root:wikitext(mw.text.trim(template))
end
end
end
end