Module:Recipe: Difference between revisions
Removed mobile-specific tags and classes |
No edit summary |
||
| (4 intermediate revisions by 2 users not shown) | |||
| Line 43: | Line 43: | ||
end | end | ||
local function addUseCategory(category, name, sort) | local function addUseCategory(category, name, quality, sort) | ||
if not name or tostring(name) == '' then | |||
return | |||
end | |||
if quality and tostring(quality) ~= '' then | |||
if sort and tostring(sort) ~= '' then | |||
category:wikitext('[[Category:Uses ', quality, '-Quality ', name, '|', sort, ']]') | |||
else | |||
category:wikitext('[[Category:Uses ', quality, '-Quality ', name, ']]') | |||
end | |||
return | |||
end | |||
if sort and tostring(sort) ~= '' then | |||
category:wikitext('[[Category:Uses ', name, '|', sort, ']]') | |||
else | |||
category:wikitext('[[Category:Uses ', name, ']]') | |||
end | |||
end | end | ||
| Line 87: | Line 97: | ||
category, | category, | ||
sName, | sName, | ||
quality, | |||
padLeft(tostring(sAmt or ''):gsub('%D', ''), 10) | padLeft(tostring(sAmt or ''):gsub('%D', ''), 10) | ||
) | ) | ||
| Line 125: | Line 136: | ||
local function renderHeader(args, output, category) | local function renderHeader(args, output, category) | ||
local header = output:tag('div'):addClass(' | local header = output:tag('div'):addClass('recipe-header') | ||
local sType = args[param.sTypeArg] | local sType = args[param.sTypeArg] | ||
header:tag('span'):addClass(' | header:tag('span'):addClass('recipe-header-main') | ||
:tag('span'):addClass(' | :tag('span'):addClass('recipe-header-text'):wikitext('[[' .. sType .. ']]'):done() | ||
category:wikitext('[[Category:' .. sType .. ']]') | category:wikitext('[[Category:' .. sType .. ']]') | ||
| Line 213: | Line 224: | ||
end | end | ||
header:tag('span'):addClass(' | header:tag('span'):addClass('recipe-header-sub') | ||
:tag('span'):wikitext(' for '):done() | :tag('span'):wikitext(' for '):done() | ||
:tag('span'):addClass(' | :tag('span'):addClass('recipe-header-text'):wikitext(sTime):done() | ||
end | end | ||
| Line 225: | Line 236: | ||
local sCharName = args[param.sCharArg] | local sCharName = args[param.sCharArg] | ||
header:tag('span'):addClass(' | header:tag('span'):addClass('recipe-header-sub') | ||
:tag('span'):wikitext('[[File:' .. sCharName .. ' Icon.png|24x24px|link=' .. sCharName .. ']]'):done() | :tag('span'):wikitext('[[File:' .. sCharName .. ' Icon.png|24x24px|link=' .. sCharName .. ']]'):done() | ||
:tag('span'):addClass(' | :tag('span'):addClass('recipe-header-text'):wikitext('[[' .. sCharName .. ']]'):done() | ||
end | end | ||
| Line 237: | Line 248: | ||
local sKitchName = args[param.sKitchArg] | local sKitchName = args[param.sKitchArg] | ||
header:tag('span'):addClass(' | header:tag('span'):addClass('recipe-header-sub') | ||
:tag('span'):wikitext('[[File:' .. sKitchName .. ' Icon.png|24x24px|link=' .. sKitchName .. ']]'):done() | :tag('span'):wikitext('[[File:' .. sKitchName .. ' Icon.png|24x24px|link=' .. sKitchName .. ']]'):done() | ||
:tag('span'):addClass(' | :tag('span'):addClass('recipe-header-text'):wikitext('[[' .. sKitchName .. ']]'):done() | ||
end | end | ||
| Line 267: | Line 278: | ||
body | body | ||
:tag('div'):addClass(' | :tag('div'):addClass('recipe-body-icon') | ||
:wikitext('➜'):done() | :wikitext('➜'):done() | ||
:tag('div'):addClass(' | :tag('div'):addClass('recipe-body-yield') | ||
:node(yieldCard) | :node(yieldCard) | ||
end | end | ||
| Line 281: | Line 292: | ||
renderCharacter(args, header) | renderCharacter(args, header) | ||
local body = output:tag('div'):addClass(' | local body = output:tag('div'):addClass('recipe-body') | ||
local sSortDelim = param.sSortDelim | local sSortDelim = param.sSortDelim | ||
| Line 389: | Line 400: | ||
local function renderCookingSplitTypeCard(category, body, ingredient) | local function renderCookingSplitTypeCard(category, body, ingredient) | ||
local qualityClass = getQualityClass(ingredient.quality or 'Gray') | |||
local container = body:tag('span') | local container = body:tag('span') | ||
| Line 453: | Line 464: | ||
local function renderCookingTypeFallback(category, body, ingredient) | local function renderCookingTypeFallback(category, body, ingredient) | ||
local wrapper = body:tag('div') | local wrapper = body:tag('div') | ||
:addClass(' | :addClass('recipe-body-cooking-ingredient') | ||
:addClass(' | :addClass('recipe-body-cooking-type-cards') | ||
for _, typeName in ipairs(ingredient.types) do | for _, typeName in ipairs(ingredient.types) do | ||
| Line 476: | Line 487: | ||
local function renderCookingOptionCards(category, body, ingredient) | local function renderCookingOptionCards(category, body, ingredient) | ||
local wrapper = body:tag('div') | local wrapper = body:tag('div') | ||
:addClass(' | :addClass('recipe-body-cooking-ingredient') | ||
:addClass(' | :addClass('recipe-body-cooking-option-cards') | ||
for _, itemName in ipairs(ingredient.options) do | for _, itemName in ipairs(ingredient.options) do | ||
| Line 517: | Line 528: | ||
body | body | ||
:tag('div'):addClass(' | :tag('div'):addClass('recipe-body-icon') | ||
:wikitext('➜'):done() | :wikitext('➜'):done() | ||
:tag('div'):addClass(' | :tag('div'):addClass('recipe-body-yield') | ||
:node(yieldCard) | :node(yieldCard) | ||
end | end | ||
| Line 531: | Line 542: | ||
local body = output:tag('div') | local body = output:tag('div') | ||
:addClass(' | :addClass('recipe-body') | ||
:addClass(' | :addClass('recipe-body-cooking') | ||
local foundIngredient = false | local foundIngredient = false | ||
| Line 572: | Line 583: | ||
function p._main(args, frame) | function p._main(args, frame) | ||
local output = mw.html.create('div') | local output = mw.html.create('div') | ||
:addClass(' | :addClass('recipe-container') | ||
local category = mw.html.create() | local category = mw.html.create() | ||