Skip to content

Commit

Permalink
Merge "Fix newline in three or more nested templates"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Jul 23, 2016
2 parents b798809 + cc98c76 commit fcc2e18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pywikibot/textlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
}}
|
(?P<unhandled_depth>{{\s*[^{\|#0-9][^{\|#]*?\s* [^{]* {{ .* }})
""", re.VERBOSE)
""", re.VERBOSE | re.DOTALL)

# The following regex supports wikilinks anywhere after the first pipe
# and correctly matches the end of the file link if the wikilink contains
Expand Down
10 changes: 10 additions & 0 deletions tests/textlib_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,16 @@ def test_regexes(self):
self.assertIsNotNone(m.group('unhandled_depth'))
self.assertTrue(m.group(0).endswith('foo {{bar}}'))

m = func('{{a|\n{{c|{{d|}} }}\n| foo = bar }} foo {{bar}} baz')
self.assertIsNotNone(m)
self.assertIsNotNone(m.group(0))
self.assertIsNone(m.group('name'))
self.assertIsNone(m.group(1))
self.assertIsNone(m.group('params'))
self.assertIsNone(m.group(2))
self.assertIsNotNone(m.group('unhandled_depth'))
self.assertTrue(m.group(0).endswith('foo {{bar}}'))


class TestGenericTemplateParams(PatchingTestCase):

Expand Down

0 comments on commit fcc2e18

Please sign in to comment.