Modul:Italic title: Unterschied zwischen den Versionen
match the start of the string as well
K (Protected Module:Italic title: High-risk Lua module ([Edit=Block all non-admin users] (indefinite) [Move=Block all non-admin users] (indefinite))) |
(match the start of the string as well) |
||
Zeile 6: | Zeile 6: | ||
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 brackets, if any. | ||
local prefix, brackets = mw.ustring.match(title.text, '(.+) (%([^%(%)]+%))$') | local prefix, brackets = mw.ustring.match(title.text, '^(.+) (%([^%(%)]+%))$') | ||
-- If brackets were found, italicise only the part before them. Otherwise | -- If brackets were found, italicise only the part before them. Otherwise | ||
-- italicise the whole title. | -- italicise the whole title. |