Skip to main content

Python Library for rendering BBCode.

Project description

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]')

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

bbcodepy-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

bbcodepy-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file bbcodepy-0.1.0.tar.gz.

File metadata

  • Download URL: bbcodepy-0.1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for bbcodepy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 74742b4e538c7f5e52156dec950c838d54cced675918746a41be8a3450317713
MD5 2f14f26b4b749e51e5c12ac26f8e0628
BLAKE2b-256 c4036fb176fbd4e3a5762716afb88a3f65a44c78d1d944baa088f3924b218ded

See more details on using hashes here.

File details

Details for the file bbcodepy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bbcodepy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for bbcodepy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c1b591e5a09340a04b1250785fceeaf27a15a552c9ae4db5f6daeeade873746
MD5 58ffe41a82d2b74cc01d55c9840f929b
BLAKE2b-256 28508fd70900c3ec8d81b15dd3d3017612c42425afe832c3d6d1e0586b121b38

See more details on using hashes here.

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