★ wanayoo — archive 1999 https://github.com/Python-Markdown/markdown/pull/641Nouvelle recherche | Portail wanayoo
Skip to content
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

Better check of allowed TOC location #641

Merged
merged 1 commit into from Mar 8, 2018

Conversation

@cbeauchesne
Copy link
Contributor

@cbeauchesne cbeauchesne commented Feb 20, 2018 •

These markdown should not raise an exception :

# *[toc]*

and

[toc]
# [toc]

Sorry if I miss something, I've tried a "blind" commit.

@@ -142,22 +142,30 @@ def iterparent(self, root):
for parent in root.iter():
for child in parent:
yield parent, child

def iter_allowed_parent(self, node):

This comment has been minimized.

@facelessuser

facelessuser Feb 20, 2018 •
Collaborator

Why did you not just modify iterparent? Now we have iterparent which is no longer used and then iter_allowed_parent. This should be consolidated into one function, and if you have dead code, it should be removed.

This comment has been minimized.

@cbeauchesne

cbeauchesne Feb 20, 2018
Author Contributor

Because it's public, and I was not sure that it's not used anywhere. But if it's not the case, it's better to simply replace it.

This comment has been minimized.

@cbeauchesne

cbeauchesne Feb 20, 2018
Author Contributor

Fixed

This comment has been minimized.

@facelessuser

facelessuser Feb 20, 2018
Collaborator

If it isn't overriding a function in the base class, it probably isn't used externally.

@cbeauchesne cbeauchesne force-pushed the cbeauchesne:fix-toc-endless-loop branch from 12f2a5d to fd99142 Feb 20, 2018
@facelessuser
Copy link
Collaborator

@facelessuser facelessuser commented Feb 20, 2018

Should probably add a unittest to ensure this bug isn't regressed in the future.

@cbeauchesne cbeauchesne force-pushed the cbeauchesne:fix-toc-endless-loop branch from fd99142 to dbd8e88 Mar 7, 2018
@cbeauchesne cbeauchesne force-pushed the cbeauchesne:fix-toc-endless-loop branch from dbd8e88 to d74edae Mar 7, 2018
@cbeauchesne
Copy link
Contributor Author

@cbeauchesne cbeauchesne commented Mar 7, 2018

@facelessuser : unittests added !

@waylan waylan merged commit 0242a96 into Python-Markdown:master Mar 8, 2018
3 checks passed
3 checks passed
codecov/patch 100% of diff hit (target 94.6%)
Details
codecov/project 94.6% (+<.01%) compared to cab4b69
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.