parser for Conde Nast BBCode


Keywords
bbcode
License
MIT
Install
pip install bbcondeparser==1.1.0

Documentation

BB Condé Parser

A portable, extensible BB Code parser written by Condé Nast Britain

Hello, World!

from bbcondeparser import BaseTag, BaseTreeParser

class ExcitedTag(BaseTag):
    tag_name = 'excite'

    def _render(self):
        child_text = self.render_children()
        return '<b><i>{}</i></b>'.format(child_text)

class Parser(BaseTreeParser):
    tags = [ExcitedTag]


parsed = Parser("[excite]Hello, World![/excite]")

print(parsed.render())
>>> python hello_world.py
<b><i>Hello, World!</i></b>
>>>

Documentation

Further documentation is in the works, and will be present on the github page.