jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1277231?usp=email )
Change subject: Fix noreferences.py skipping references header without trailing
newline
......................................................................
Fix noreferences.py skipping references header without trailing newline
Bug: T424283
Change-Id: I3fc4139a90d85fe19d362ae39f52f14a14e4717b
---
M scripts/noreferences.py
1 file changed, 4 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/noreferences.py b/scripts/noreferences.py
index 996d9cc..de341a4 100755
--- a/scripts/noreferences.py
+++ b/scripts/noreferences.py
@@ -668,7 +668,7 @@
# Set the edit summary key for this case
self.summary_key = 'noreferences-add-tag'
for section in i18n.translate(self.site, referencesSections) or []:
- sectionR = re.compile(fr'\r?\n=+ *{section} *=+ *\r?\n')
+ sectionR = re.compile(fr'\r?\n=+ *{section} *=+ *(?=\r?\n|$)')
index = 0
while index < len(oldText):
match = sectionR.search(oldText, index)
@@ -684,10 +684,11 @@
r'^((?:\s*(?:\{\{[^\{\}]*?\}\}|<!--.*?-->))*)',
flags=re.DOTALL)
return (
- oldText[:match.end() - 1]
+ oldText[:match.end()]
+ templates_or_comments.sub(
fr'\1\n{self.referencesText}\n',
- oldText[match.end() - 1:])
+ oldText[match.end():]
+ )
)
else:
break
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1277231?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I3fc4139a90d85fe19d362ae39f52f14a14e4717b
Gerrit-Change-Number: 1277231
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-CC: Aram <[email protected]>
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]