Module:TagInfoCard: Difference between revisions
From Eco - English Wiki
| [checked revision] | [checked revision] |
No edit summary |
No edit summary |
||
| Line 22: | Line 22: | ||
WikiText = WikiText .. IconUtils.main{ name = Tag.Name[Lang], id = TagID, size = 128, style = 4, } | WikiText = WikiText .. IconUtils.main{ name = Tag.Name[Lang], id = TagID, size = 128, style = 4, } | ||
WikiText = WikiText .. ' | |||
WikiText = WikiText .. '<h3>Items in Tag:</h3>' | |||
WikiText = WikiText .. '<div class="row">' | WikiText = WikiText .. '<div class="row">' | ||
| Line 32: | Line 33: | ||
WikiText = WikiText .. '</div>' | WikiText = WikiText .. '</div>' | ||
WikiText = WikiText .. RecipeUtils. | local RecipeTagIngredients = RecipeUtils.TagIngredients(TagName) | ||
if (RecipeTagIngredients ~= "") then | |||
WikiText = WikiText .. '<h3>Used in:</h3>'; | |||
WikiText = WikiText .. RecipeUtils.CraftTable(RecipeTagIngredients) | |||
end | |||
return WikiText | return WikiText | ||
Revision as of 12:54, 25 August 2025
Documentation for this module may be created at Module:TagInfoCard/doc
local p = {}
local Utils = require('Module:Utils')
local IconUtils = require('Module:IconUtils')
local RecipeUtils = require('Module:RecipeUtils')
local L = require('Module:Localization')
local Lang = Utils.getLanguageName()
function p.main(frame)
local PageName = frame.args[1]
PageName = string.gsub(PageName," Tag", "")
if (Lang == 'English') then TagName = PageName else TagName = Utils.TagSearch(PageName) end
local TagData = require( "Module:TagData" )
local ItemData = require( "Module:ItemData" )
local Tag = TagData.tags[TagName]
local TagID = Tag.ID
local ItemList = Tag.Items
local WikiText =''
WikiText = WikiText ..'page name get test: ' .. PageName ..'</br>'
WikiText = WikiText ..'Tag name get test: ' .. TagName ..'</br>'
WikiText = WikiText .. IconUtils.main{ name = Tag.Name[Lang], id = TagID, size = 128, style = 4, }
WikiText = WikiText .. '<h3>Items in Tag:</h3>'
WikiText = WikiText .. '<div class="row">'
for Count, ItemName in pairs(ItemList) do
Item = ItemData.items[ItemName]
WikiText = WikiText .. IconUtils.main{ name = Item.Name[Lang], id = Item.ID, size = 128, style = 4, link = Item.Name[Lang] }
end
WikiText = WikiText .. '</div>'
local RecipeTagIngredients = RecipeUtils.TagIngredients(TagName)
if (RecipeTagIngredients ~= "") then
WikiText = WikiText .. '<h3>Used in:</h3>';
WikiText = WikiText .. RecipeUtils.CraftTable(RecipeTagIngredients)
end
return WikiText
end
return p