BBCODEPY
bbcodepy is a fast Python BBCode parser and renderer.
Usage
All common BBCode tags are supported by default.
import bbcodepy
print bbcodepy.Parser().to_html('[b]Hello![/b]')
Easily add new tags!
import bbcodepy
class YoutubeTag(bbcodepy.Tag):
def to_html(self):
attributes = {
'src': self.get_content(True).strip(),
'width': self.params.get('width', 420),
'height': self.params.get('height', 315)
}
return '<iframe %s frameborder="0" allowfullscreen></iframe>' % self.renderer.html_attributes(attributes)
parser = bbcodepy.Parser()
parser.register_tag('youtube', YoutubeTag)
print parser.to_html('[youtube width=420 height=315]http://www.youtube.com/embed/rWTa6OKgWlM[/youtube]')
Metadata
Release files for bbcodepy 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bbcodepy-0.2.0.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bbcodepy-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.4 kB
Release files / bbcodepy-0.2.0.tar.gz
| Download URL | bbcodepy-0.2.0.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b68b1ce3202701cb6ed04ffb0b82232c8df8e7f0688e91caf4efc60522cb154
|
|
BLAKE2b-256 checksum How to use checksums |
0b03dcdcbf3e0cce2f5dc3399a6bacdab17117cc0b1b5e72359880f94ccecd27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0
|
Release files / bbcodepy-0.2.0-py3-none-any.whl
| Download URL | bbcodepy-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36a7734bab401b88feae76458c1b3accfdf352fe2bc65656613997fb17fef654
|
|
BLAKE2b-256 checksum How to use checksums |
40153b3d0d8bf37f7dcfeba53c652819cca5abaf746e5ceefb648ca41399a2ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0
|