Jump to content
Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
If you make an edit, a temporary account will be created for you.

Module:Sandbox/Stevium: Difference between revisions

From The Petit Planet Wiki
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 no_text = tostring(args.no_text or args.notext) == '1'
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 filename = 'File:' .. prefix .. item .. suffix .. '.png'
local fileName = 'File:' .. prefix .. item .. suffix .. '.png'
local class = invertClass and ('|class=' .. invertClass) or ''
local class = invertClass and ('|class=' .. invertClass) or ''
local file = '[[' .. filename .. '|' .. size .. 'x' .. size .. 'px|alt=' .. item .. '|link=' .. link .. class .. ']]'
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 no_text) then
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((no_text and '' or ' ') .. '×' .. count)
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(((no_text and not count) and '' or ' '),'(', note, ')', after)
item_text:tag('small'):wikitext(((noText and not count) and '' or ' '),'(', note, ')', after)
end
end