Skip to content

bbcodepy is a fast Python BBCode parser and renderer

License

Notifications You must be signed in to change notification settings

mociepka/bbcodepy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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(bbcode.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)

pareser = bbcodepy.Parser()
parser.register_tag('youtube', YoutubeTag)

print parser.to_html('[youtube width=420 height=315]http://www.youtube.com/embed/rWTa6OKgWlM[/youtube]')

About

bbcodepy is a fast Python BBCode parser and renderer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%