jenkins-bot submitted this change.

View Change


Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
Improve PagesTagParser()

Add default argument.
Reorder attributes.

Change-Id: I2dddc4612769434255bd8785c02a65746fd338ba
---
M pywikibot/proofreadpage.py
1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/pywikibot/proofreadpage.py b/pywikibot/proofreadpage.py
index 4149124..e7151ce 100644
--- a/pywikibot/proofreadpage.py
+++ b/pywikibot/proofreadpage.py
@@ -222,6 +222,10 @@
Parse text and extract the first ``<pages ... />`` tag.
Individual attributes will be accessible with dot notation.

+ >>> tp = PagesTagParser('<pages />')
+ >>> tp
+ PagesTagParser('<pages />')
+
>>> tp = PagesTagParser(
... 'Text: <pages index="Index.pdf" from="first" to="last" />')
>>> tp
@@ -280,8 +284,8 @@
'exclude',
'step',
'header',
- 'tosection',
'fromsection',
+ 'tosection',
'onlysection',
)
tokens = '(' + '=|'.join(tokens) + '=)'
@@ -294,11 +298,11 @@
exclude = TagAttrDesc()
step = TagAttrDesc()
header = TagAttrDesc()
- tosection = TagAttrDesc()
fromsection = TagAttrDesc()
+ tosection = TagAttrDesc()
onlysection = TagAttrDesc()

- def __init__(self, text):
+ def __init__(self, text='<pages />'):
"""Initializer."""
m = self.pat_tag.search(text)
if m is None:

To view, visit change 900764. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I2dddc4612769434255bd8785c02a65746fd338ba
Gerrit-Change-Number: 900764
Gerrit-PatchSet: 1
Gerrit-Owner: Mpaa <mpaa.wiki@gmail.com>
Gerrit-Reviewer: Mpaa <mpaa.wiki@gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged