Module:Italic title and Module:Italic title/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
Replace Module:No globals with require( "strict" ) |
use require('strict') instead of require('Module:No globals') |
||
Line 82: | Line 82: | ||
prefix, parentheses = mw.ustring.match( |
prefix, parentheses = mw.ustring.match( |
||
title.text, |
title.text, |
||
'^(.+) |
'^(.+) (%())$' |
||
) |
) |
||
end |
end |
||
if parentheses then |
|||
parentheses = parentheses:sub(2, -2) |
|||
end |
|||
if prefix and parentheses then |
if prefix and parentheses then |
||
self.title = prefix |
self.title = prefix |
||
Line 197: | Line 202: | ||
-- italicization of the main part of the title. |
-- italicization of the main part of the title. |
||
if next(italicizedSubstrings) then |
if next(italicizedSubstrings) then |
||
local originalString |
|||
⚫ | |||
if titleParts.dab then |
|||
originalString = self.dab |
|||
else |
|||
originalString = self.title |
|||
end |
|||
for s in pairs(italicizedSubstrings) do |
for s in pairs(italicizedSubstrings) do |
||
local pattern = escapeMagicCharacters(s) |
local pattern = escapeMagicCharacters(s) |
||
local italicizedTitle, nReplacements = |
local italicizedTitle, nReplacements = :gsub( |
||
pattern, |
pattern, |
||
italicize |
italicize |
||
) |
) |
||
⚫ | |||
if titleParts.dab then |
|||
⚫ | |||
else |
|||
⚫ | |||
end |
|||
-- If we didn't make any replacements then it means that we |
-- If we didn't make any replacements then it means that we |
||
Line 294: | Line 309: | ||
function p._dabonly(args) |
function p._dabonly(args) |
||
ItalicTitle.new() |
|||
if args.string then |
|||
⚫ | |||
italicTitle:italicizeSubstring(args.string) |
|||
⚫ | |||
else |
|||
⚫ | |||
end |
|||
⚫ | |||
end |
end |
||