jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/900764 )
Change subject: Improve PagesTagParser() ......................................................................
Improve PagesTagParser()
Add default argument. Reorder attributes.
Change-Id: I2dddc4612769434255bd8785c02a65746fd338ba --- M pywikibot/proofreadpage.py 1 file changed, 19 insertions(+), 3 deletions(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
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:
pywikibot-commits@lists.wikimedia.org