Module:Inventory slot: Difference between revisions

Jump to navigation Jump to search
Add support for custom hex code colors
No edit summary
(Add support for custom hex code colors)
 
(12 intermediate revisions by the same user not shown)
Line 139: Line 139:
-- link = nil
-- link = nil
-- end
-- end
-- local link = args.link or ''
-- if link == '' then
-- if mod then  -- <----- this if statement is edited too
-- if mod == "parallel" then
-- link = name
-- else
-- link = i18n.modLink:gsub( '%$1', mod ):gsub( '%$2', name )
-- end
-- else
-- link = name:gsub( '^' .. i18n.prefixes.damaged .. ' ', '' ) .. ' (Vanilla)'
-- for _, suffix in pairs( i18n.suffixes ) do
-- link = link:gsub( ' ' .. suffix .. '$', '' )
-- end
-- end
-- elseif link:lower() == 'none' then
-- link = nil
-- end
-- if link == pageName then
-- link = nil
-- end
local link = args.link or ''
local link = args.link or ''
Line 149: Line 170:
end
end
else
else
link = name:gsub( '^' .. i18n.prefixes.damaged .. ' ', '' ) .. ' (Vanilla)'
if mw.title.new(name).exists == false then
for _, suffix in pairs( i18n.suffixes ) do
link = i18n.modLink:gsub( '%$1', 'mcwiki' ):gsub( '%$2', name )
link = link:gsub( ' ' .. suffix .. '$', '' )
else
link = name:gsub( '^' .. i18n.prefixes.damaged .. ' ', '' )
for _, suffix in pairs( i18n.suffixes ) do
link = link:gsub( ' ' .. suffix .. '$', '' )
end
end
end
end
end
Line 159: Line 184:
if link == pageName then
if link == pageName then
link = nil
link = nil
end
end
local formattedTitle
local formattedTitle
Line 168: Line 193:
plainTitle = title:gsub( '\\\\', '&#92;' ):gsub( '\\&', '&#38;' )
plainTitle = title:gsub( '\\\\', '&#92;' ):gsub( '\\&', '&#38;' )
local formatPattern = '&[0-9a-fk-or]'
local formatPatterns = {'&[0-9a-jl-qs-vyzr]', '&#%x%x%x%x%x%x', '&$%x%x%x'}
if plainTitle:match( formatPattern ) then
for _, formatPattern in ipairs( formatPatterns ) do
formattedTitle = title
if plainTitle:match( formatPattern ) then
plainTitle = plainTitle:gsub( formatPattern, '' )
formattedTitle = title
plainTitle = plainTitle:gsub( formatPattern, '' )
end
end
end

Navigation menu