Module:Sandbox/Stevium: Difference between revisions
From The Petit Planet Wiki
More actions
No edit summary |
No edit summary |
||
| Line 21: | Line 21: | ||
local invert = lib.nilIfEmpty(args.invert) | local invert = lib.nilIfEmpty(args.invert) | ||
local newline = tostring(args.newline) == '1' | local newline = tostring(args.newline) == '1' | ||
local | local noText = tostring(args.no_text or args.notext) == '1' | ||
local white = tostring(args.white) == '1' | local white = tostring(args.white) == '1' | ||
| Line 44: | Line 44: | ||
if (white) then suffix = suffix .. ' White' end | if (white) then suffix = suffix .. ' White' end | ||
local | local fileName = 'File:' .. prefix .. item .. suffix .. '.png' | ||
local class = invertClass and ('|class=' .. invertClass) or '' | local class = invertClass and ('|class=' .. invertClass) or '' | ||
local file = '[[' .. | local file = '[[' .. fileName .. '|' .. size .. 'x' .. size .. 'px|alt=' .. item .. '|link=' .. link .. class .. ']]' | ||
local icon = nil | local icon = nil | ||
| Line 120: | Line 120: | ||
local item_text = result:tag('span'):addClass('item-text') | local item_text = result:tag('span'):addClass('item-text') | ||
if (not | if (not noText) then | ||
local before = newline and '' or ' ' | local before = newline and '' or ' ' | ||
local ame = ((count or note) and {text, ''} or parseAmE(text, '')) | local ame = ((count or note) and {text, ''} or parseAmE(text, '')) | ||
| Line 139: | Line 139: | ||
count = table.concat(note and {count, ''} or parseAmE(count, ''), '') | count = table.concat(note and {count, ''} or parseAmE(count, ''), '') | ||
if (ref and not note) then count:gsub('%s*$', '') end | if (ref and not note) then count:gsub('%s*$', '') end | ||
item_text:wikitext(( | item_text:wikitext((noText and '' or ' ') .. '×' .. count) | ||
end | end | ||
| Line 145: | Line 145: | ||
local after = table.concat(parseAmE('', ''), '') | local after = table.concat(parseAmE('', ''), '') | ||
if (ref) then after:gsub('%s*$', '') end | if (ref) then after:gsub('%s*$', '') end | ||
item_text:tag('small'):wikitext((( | item_text:tag('small'):wikitext(((noText and not count) and '' or ' '),'(', note, ')', after) | ||
end | end | ||