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
Release history Release notifications | RSS feed
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.1.0.tar.gz
(19.0 kB
view hashes)