mAucun résumé des modifications |
Westgrass (discussion | contributions) Aucun résumé des modifications |
||
Ligne 25 : | Ligne 25 : | ||
tr:tag('td'):attr('colspan', 3):tag('i'):addClass('note-text'):wikitext(i18n.Deprecated) |
tr:tag('td'):attr('colspan', 3):tag('i'):addClass('note-text'):wikitext(i18n.Deprecated) |
||
else |
else |
||
− | + | local name = currentFrame:expandTemplate{title = 'itemNameFromId', args = {id, lang=en}} |
|
+ | tr:tag('td'):wikitext(('[[%s]] (%s)'):format(currentFrame:expandTemplate{title = 'tr', args = {name}}, name)) |
||
tr:tag('td'):wikitext('???') |
tr:tag('td'):wikitext('???') |
||
end |
end |
||
Ligne 33 : | Ligne 34 : | ||
local tr = output:tag('tr') |
local tr = output:tag('tr') |
||
tr:tag('td'):wikitext(itemid) |
tr:tag('td'):wikitext(itemid) |
||
− | tr:tag('td'):wikitext(('[[%s|%s]]'):format(row.page, row.name)) |
+ | tr:tag('td'):wikitext(('[[%s|%s]] (%s)'):format(row.page, currentFrame:expandTemplate{title = 'tr', args = {row.name}}, row.name)) |
tr:tag('td'):wikitext(tostring(mw.html.create('code'):wikitext(row.internalname))) |
tr:tag('td'):wikitext(tostring(mw.html.create('code'):wikitext(row.internalname))) |
||
last = itemid |
last = itemid |
Version du 31 mai 2020 à 05:01
Documentation
Voir aussi la page anglaise du module : Module:ItemID. Elle pourra contenir des informations plus complètes et actuelles.
Aucune sous-page de documentation n'existe déjà pour ce module. En créer une maintenant.
local i18n = {
Id = 'ID',
Name = 'Nom',
EnglishName = 'Nom anglais',
InternalName = 'Nom interne',
Deprecated = '(Obsolète)',
}
local total = 5042 -- as in 1.4.0.3
local data={}
local unused = require('Module:Iteminfo/idSets').getIdSet('Unused')
local last = 0
local output = mw.html.create('table'):addClass('terraria sortable lined aligncenter')
local currentFrame
function printRow(row)
local itemid = tonumber(row.itemid)
if itemid > last + 1 then
for id = last+1, itemid-1 do
local tr = output:tag('tr')
tr:tag('td'):wikitext(id)
if unused[id] then
tr:tag('td'):attr('colspan', 3):tag('i'):addClass('note-text'):wikitext(i18n.Deprecated)
else
local name = currentFrame:expandTemplate{title = 'itemNameFromId', args = {id, lang=en}}
tr:tag('td'):wikitext(('[[%s]] (%s)'):format(currentFrame:expandTemplate{title = 'tr', args = {name}}, name))
tr:tag('td'):wikitext('???')
end
end
end
local tr = output:tag('tr')
tr:tag('td'):wikitext(itemid)
tr:tag('td'):wikitext(('[[%s|%s]] (%s)'):format(row.page, currentFrame:expandTemplate{title = 'tr', args = {row.name}}, row.name))
tr:tag('td'):wikitext(tostring(mw.html.create('code'):wikitext(row.internalname)))
last = itemid
end
return {
main=function(frame)
currentFrame = frame
local header = output:tag('tr')
header:tag('th'):wikitext(i18n.Id)
header:tag('th'):wikitext(i18n.Name)
header:tag('th'):wikitext(i18n.InternalName)
-- There are more than 5000 items now.
local result = mw.ext.cargo.query(
'Items_new',
'_pageName=page, itemid, name, imagefile, internalname',
{
groupBy = 'itemid',
orderBy = 'itemid',
where = 'itemid IS NOT NULL AND itemid <=4000 AND internalname <> ""',
limit = 5000
}
)
for _, row in ipairs(result) do
printRow(row)
end
local result = mw.ext.cargo.query(
'Items_new',
'_pageName=page, itemid, name, imagefile , internalname',
{
groupBy = 'itemid',
orderBy = 'itemid',
where = 'itemid IS NOT NULL AND itemid > 4000 AND internalname <> ""',
limit = 5000
}
)
for _, row in ipairs(result) do
printRow(row)
end
-- tails
for id = last+1, total do
local tr = output:tag('tr')
tr:tag('td'):wikitext(id)
if unused[id] then
tr:tag('td'):attr('colspan', 2):tag('i'):addClass('note-text'):wikitext(i18n.Deprecated)
else
tr:tag('td'):wikitext(('[[%s]]'):format(currentFrame:expandTemplate{title = 'ItemNameFromId', args = {id}}))
tr:tag('td'):wikitext('???')
end
end
return output
end,
}