Skip to main content

parser for Conde Nast BBCode

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bbcondeparser-1.0.1.tar.gz (18.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page