Zum Inhalt springen

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 brackets, if any.
     -- Find the parts before and after the disambiguation parentheses, if any.
     local prefix, brackets = mw.ustring.match(title.text, '^(.+) (%([^%(%)]+%))$')
     local prefix, parentheses = mw.ustring.match(title.text, '^(.+) (%([^%(%)]+%))$')
     -- If brackets were found, italicise only the part before them. Otherwise
     -- 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 brackets and args.all ~= 'yes' then
     if prefix and parentheses and args.all ~= 'yes' then
         result = "''" .. prefix .. "'' " .. brackets
         result = "''" .. prefix .. "'' " .. parentheses
     else
     else
         result = "''" .. title.text .. "''"
         result = "''" .. title.text .. "''"
Anonymer Benutzer