Modul:Italic title: Unterschied zwischen den Versionen
change "brackets" to "parentheses" per protected edit request
(re-add all=yes - I made a mistake with the args logic) |
(change "brackets" to "parentheses" per protected edit request) |
||
Zeile 17: | Zeile 17: | ||
local title = mw.title.getCurrentTitle() -- Get the current page object. | local title = mw.title.getCurrentTitle() -- Get the current page object. | ||
-- Find the parts before and after the disambiguation | -- Find the parts before and after the disambiguation parentheses, if any. | ||
local prefix, | local prefix, parentheses = mw.ustring.match(title.text, '^(.+) (%([^%(%)]+%))$') | ||
-- If | -- If parentheses were found, italicise only the part before them. Otherwise | ||
-- italicise the whole title. | -- italicise the whole title. | ||
local result | local result | ||
if prefix and | if prefix and parentheses and args.all ~= 'yes' then | ||
result = "''" .. prefix .. "'' " .. | result = "''" .. prefix .. "'' " .. parentheses | ||
else | else | ||
result = "''" .. title.text .. "''" | result = "''" .. title.text .. "''" |