Files @ b50974263c36
Branch filter:

Location: symposion_app/symposion/markdown_parser.py

Hiroshi Miura
i18n sponsor fields

Feedback from PyConJP development

```
commit 5973e32ebdc231b209b5c058664e8b2b4a1dbc54
Author: MURAOKA Yusuke <yusuke@jbking.org>
Date: Mon Mar 31 15:35:40 2014 +0900

introduce Benefit.content_type which is used to display localized
text
```

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
from html5lib import html5parser, sanitizer

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)
    for token in parser.parseFragment(text).childNodes:
        bits.append(token.toxml())
    return "".join(bits)