jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/471765 )
Change subject: [IMPR] Use page.title(without_brackets) for titletranslate
......................................................................
[IMPR] Use page.title(without_brackets) for titletranslate
Use the newly added title parameter without_brackets to build a title
without trailing brackets including their content.
The behavior is changed a bit by only remove the last bracket content whereas
the previous implementation also could remove bracket content at the beginning
of the page title which isn't what the -hintnobracket of interwiki suggests.
Change-Id: Ie6a662489df25430aa37c22e9e3dd2d59f3161ce
---
M pywikibot/titletranslate.py
M scripts/interwiki.py
2 files changed, 3 insertions(+), 8 deletions(-)
Approvals:
Framawiki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/titletranslate.py b/pywikibot/titletranslate.py
index 8868ef2..5117372 100644
--- a/pywikibot/titletranslate.py
+++ b/pywikibot/titletranslate.py
@@ -9,8 +9,6 @@
#
from __future__ import absolute_import, division, unicode_literals
-import re
-
import pywikibot
from pywikibot import date
@@ -47,11 +45,8 @@
# we're currently working on ...
if page is None:
continue
- newname = page.title(with_ns=False)
- # ... unless we do want brackets
- if removebrackets:
- newname = re.sub(re.compile(r'\W*?\(.*?\)\W*?',
- re.UNICODE), ' ', newname)
+ newname = page.title(with_ns=False,
+ without_brackets=removebrackets)
if codes.isdigit():
codes = site.family.languages_by_size[:int(codes)]
elif codes == 'all':
diff --git a/scripts/interwiki.py b/scripts/interwiki.py
index 4a325a3..f8909bd 100755
--- a/scripts/interwiki.py
+++ b/scripts/interwiki.py
@@ -197,7 +197,7 @@
dates, only use found links and hints.
(note: without ending colon)
- -hintnobracket used to make the bot strip everything in brackets,
+ -hintnobracket used to make the bot strip everything in last brackets,
and surrounding spaces from the page name, before it is
used in a -hint:xy: where the page name has been left out,
or -hint:all:, -hint:10:, etc. without a name, or
--
To view, visit
https://gerrit.wikimedia.org/r/471765
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie6a662489df25430aa37c22e9e3dd2d59f3161ce
Gerrit-Change-Number: 471765
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Framawiki <framawiki(a)tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)