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

html5lib 0.999 pinning causes a markdown parser error #71

Open
daaray opened this issue Mar 12, 2015 · 3 comments
Open

html5lib 0.999 pinning causes a markdown parser error #71

daaray opened this issue Mar 12, 2015 · 3 comments

Comments

@daaray
Copy link
Contributor

daaray commented Mar 12, 2015

The pinned requirement causes the markdown parser to throw errors:

  File "/home/daaray/.virtualenvs/conf_site/local/lib/python2.7/site-packages/sy
mposion/markdown_parser.py", line 15, in parse
    for token in parser.parseFragment(text).childNodes:
AttributeError: childNodes

This is due to html5lib/html5lib-python#45.

We need to either revert the pin to 0.95 or modify the parser by specifying the tree builder:

from html5lib import html5parser, sanitizer, getTreeBuilder

import markdown


def parse(text):

    # First run through the Markdown parser
    text = markdown.markdown(text, extensions=["extra"], safe_mode=False)

    # Sanitize using html5lib
    bits = []
    parser = html5parser.HTMLParser(tokenizer=sanitizer.HTMLSanitizer, tree=getTreeBuilder("dom"))
    for token in parser.parseFragment(text).childNodes:
        bits.append(token.toxml())
    return "".join(bits)
@miurahr
Copy link
Contributor

miurahr commented Jun 28, 2015

@daaray Could you send PR for this issue?

miurahr added a commit to miurahr/symposion that referenced this issue Oct 17, 2015
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
@miurahr
Copy link
Contributor

miurahr commented Oct 17, 2015

fixed by 11f697d

@ossanna16
Copy link
Contributor

Can this issue be closed? It seems to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants