jenkins-bot submitted this change.
[doc] Explain the links counter
Change-Id: Ibed34ff04e4d0739c07b14b4c56b75e717971af9
---
M scripts/solve_disambiguation.py
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 8694a1b..ee9544f 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -873,7 +873,7 @@
if include:
# save the original text so we can show the changes later
original_text = text
- n = 0
+ n_links = 0 # number of links
curpos = 0
dn = False
edited = False
@@ -881,11 +881,13 @@
while True:
m = self.linkR.search(text, pos=curpos)
if not m:
- if n == 0:
- # No changes necessary for this disambiguation title.
+ # No additinal link found
+ if n_links == 0:
+ # No remaining links to change for this disambiguation
+ # title.
return 'nochange'
- # stop loop and save page
+ # There are links to change; stop loop and save page
break
# Ensure that next time around we will not find this same hit.
@@ -911,7 +913,7 @@
.format(m['title'], ref_page.title()))
continue
- n += 1
+ n_links += 1 # new link found: increase link counter
# how many bytes should be displayed around the current link
context = 60
@@ -964,7 +966,8 @@
break
if answer == 's':
- n -= 1 # TODO what's this for?
+ # skip this link and decrease link counter
+ n_links -= 1
continue
if answer == 'e':
To view, visit change 945551. To unsubscribe, or for help writing mail filters, visit settings.