8,282
edits
No edit summary Tag: Reverted |
(Add support for custom hex code colors) |
||
(17 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
modLink = '$1:$2', | modLink = '$1:$2', | ||
moduleAliases = [[Module:Inventory slot/Aliases]], | moduleAliases = [[Module:Inventory slot/Aliases]], | ||
moduleParallelAliases = [[Module:ParallelAliases]], | |||
moduleRandom = [[Module:Random]], | moduleRandom = [[Module:Random]], | ||
-- List of special prefixes which should be handled by | -- List of special prefixes which should be handled by | ||
Line 26: | Line 27: | ||
local random = require( i18n.moduleRandom ).random | local random = require( i18n.moduleRandom ).random | ||
local aliases = mw.loadData( i18n.moduleAliases ) | local aliases = mw.loadData( i18n.moduleAliases ) | ||
local parallelAliases = mw.loadData( i18n.moduleParallelAliases ) | |||
local pageName = mw.title.getCurrentTitle().text | local pageName = mw.title.getCurrentTitle().text | ||
Line 137: | 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 147: | Line 170: | ||
end | end | ||
else | else | ||
link = | if mw.title.new(name).exists == false then | ||
link = i18n.modLink:gsub( '%$1', 'mcwiki' ):gsub( '%$2', name ) | |||
else | |||
link = name:gsub( '^' .. i18n.prefixes.damaged .. ' ', '' ) | |||
for _, suffix in pairs( i18n.suffixes ) do | |||
link = link:gsub( ' ' .. suffix .. '$', '' ) | |||
end | |||
end | end | ||
end | end | ||
Line 157: | Line 184: | ||
if link == pageName then | if link == pageName then | ||
link = nil | link = nil | ||
end | end | ||
local formattedTitle | local formattedTitle | ||
Line 166: | Line 193: | ||
plainTitle = title:gsub( '\\\\', '\' ):gsub( '\\&', '&' ) | plainTitle = title:gsub( '\\\\', '\' ):gsub( '\\&', '&' ) | ||
local | 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 | ||
if plainTitle:match( formatPattern ) then | |||
formattedTitle = title | |||
plainTitle = plainTitle:gsub( formatPattern, '' ) | |||
end | |||
end | end | ||
Line 337: | Line 366: | ||
-- end | -- end | ||
if frame.mod then -- <--- THIS IS CHANGED | if frame.mod then -- <--- THIS IS CHANGED | ||
if frame.mod | if frame.mod == 'parallel' then | ||
modData.aliases = parallelAliases | |||
else | |||
id = frame.mod .. ':' .. id | id = frame.mod .. ':' .. id | ||
end | end |