May 31, 2007 will

BBCode Python Module III

I had a little spare time to do some work on postmarkup.py, my BBCode module. It now handles Unicode correctly, which was a big omission, considering its intended use. I also added a few other features. The tag parameter string can now be specified in 3(!) different ways. For example, the following 3 lines are equivalent.

[link=http://www.willmcgugan.com]My homepage[/link]

[link="http://www.willmcgugan.com"]My homepage[/link]

[link http://www.willmcgugan.com]My homepage[/link]

Another addition, is an [img] tag.

[img]http://www.willmcgugan.com/wp-content/uploads/ant.png[/img]

There is also support for lists (ordered and un-ordered), with the phpbb syntax. For example:

[list]

[*]Apples

[*]Oranges

[*]Pears

[/list]

This produces an un-ordered list.

  • Apples
  • Oranges
  • Pears

I didn't implement the [size] and [color] tags, because for my purposes I don't want users creating annoying text! If you need them, take a look at the code - new tags are fairly easy to implement. For more information, please see the other posts regarding bbcode on my blog, or contact me.

Download postmarkup.py

I plan on putting postmarkup and some of my other open source code on google code when I have more spare time. Bare with me folks!

Use Markdown for formatting
*Italic* **Bold** `inline code` Links to [Google](http://www.google.com) > This is a quote > ```python import this ```
your comment will be previewed here
gravatar
Jesper

Good job, thanks for including my suggestions/fixes!

I completely agree that the omission of [size] and [color] are good. I don't want them on my site either, and I would have disabled them if you had them in there.