Modul:Italic title: Unterschied zwischen den Versionen
Undid revision 1029073259 by Gonnym (talk) undo for now, as this breaks Template:Italic title transclusions that 1) have a dab, 2) use the "string" argument, and 3) don't use the "all" argument
(added support for string= in italic dab; fixed edge cases where module failed. All changes tested at Module talk:Italic title/testcases. Ping if you encounter an issue) |
(Undid revision 1029073259 by Gonnym (talk) undo for now, as this breaks Template:Italic title transclusions that 1) have a dab, 2) use the "string" argument, and 3) don't use the "all" argument) |
||
Zeile 82: | Zeile 82: | ||
prefix, parentheses = mw.ustring.match( | prefix, parentheses = mw.ustring.match( | ||
title.text, | title.text, | ||
'^(.+) (% | '^(.+) %(([^%(%)]+)%)$' | ||
) | ) | ||
end | end | ||
if prefix and parentheses then | if prefix and parentheses then | ||
self.title = prefix | self.title = prefix | ||
Zeile 202: | Zeile 197: | ||
-- italicization of the main part of the title. | -- italicization of the main part of the title. | ||
if next(italicizedSubstrings) then | if next(italicizedSubstrings) then | ||
titleParts.title = self.title | |||
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 = titleParts.title:gsub( | ||
pattern, | pattern, | ||
italicize | italicize | ||
) | ) | ||
titleParts.title = italicizedTitle | |||
-- If we didn't make any replacements then it means that we | -- If we didn't make any replacements then it means that we | ||
Zeile 309: | Zeile 294: | ||
function p._dabonly(args) | function p._dabonly(args) | ||
return ItalicTitle.new() | |||
:italicize('dab') | |||
:render(args[1]) | |||
end | end | ||