Skip to content

Commit

Permalink
Merge "proofreadpage.py: purge is skipped if redlinks are present"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Feb 27, 2017
2 parents 1126dfd + 545b6cb commit a463c17
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pywikibot/proofreadpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,14 +544,16 @@ def _get_page_mappings(self):

self._parsed_text = self._get_parsed_page()
self._soup = BeautifulSoup(self._parsed_text, 'html.parser')
attrs = {'class': re.compile('prp-pagequality|new')}
# Do not search for "new" here, to avoid to skip purging if links
# to non-existing pages are present.
attrs = {'class': re.compile('prp-pagequality')}

# Search for attribute "prp-pagequality" in tags:
# Existing pages:
# <a href="/wiki/Page:xxx.djvu/n"
# title="Page:xxx.djvu/n">m
# class="quality1 prp-pagequality-1"
# </a> or
# </a>
# Non-existing pages:
# <a href="/w/index.php?title=xxx&amp;action=edit&amp;redlink=1"
# class="new"
Expand All @@ -570,6 +572,8 @@ def _get_page_mappings(self):
'class="new" in: %s.'
% self)

# Search for attribute "prp-pagequality" or "new" in tags:
attrs = {'class': re.compile('prp-pagequality|new')}
page_cnt = 0
for a_tag in self._soup.find_all('a', attrs=attrs):
label = a_tag.text.lstrip('0') # Label is not converted to int.
Expand Down

0 comments on commit a463c17

Please sign in to comment.