Repository navigation
Fix quadratic time for unclosed brackets in link text #1664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -164,6 +164,19 @@ def test_angles_and_nonsense_url(self): | |
| '<p><a href="?}]*+|&)">test nonsense</a>.</p>' | ||
| ) | ||
|
|
||
| def test_unclosed_square_brackets(self): | ||
| self.assertMarkdownRenders( | ||
| '[[[Text](http://link.com) [more [text', | ||
| '<p>[[<a href="http://link.com">Text</a> [more [text</p>' | ||
| ) | ||
|
|
||
| def test_many_unclosed_square_brackets(self): | ||
| # Each unclosed bracket used to rescan the rest of the text. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The spell checker seems to not like the word "rescan." It should probably be added to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
| self.assertMarkdownRenders( | ||
| '[[' * 10000 + '[Text](http://link.com)', | ||
| '<p>' + '[[' * 10000 + '<a href="http://link.com">Text</a></p>' | ||
| ) | ||
|
|
||
|
|
||
| class TestReferenceLinks(TestCase): | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not declare this in
__init__and defaul it toNoneso we don't have to check if it exists every time. It should just always exist.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For clarity,
_bracket_datashould be initialized in__init__.