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.
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 details)
File details
Details for the file bbcondeparser-1.1.0.tar.gz.
File metadata
- Download URL: bbcondeparser-1.1.0.tar.gz
- Upload date:
- Size: 19.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/2.7.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
891b3df2417d2e21049069008dd25c4fdede3ea171a85c8adc66d909f868c641
|
|
| MD5 |
b3b022739ed08fa150b2556a8a5b9e6c
|
|
| BLAKE2b-256 |
5e93971aed9c21728e0fb1c80b8adc711f199ea8f7c8249e37f4f15b6f3ba79e
|