BBCode

Terry Hancock hancock at anansispaceworks.com
Tue Dec 3 14:07:05 EST 2002


I'm implementing a forum in Python/Zope,  which, BTW, now has an (I hope!) 
fulling working pre-alpha demo at

http://narya.net/

Currently, it only supports "HTML" posting (i.e. you have to type HTML code 
into the posting form. Adding structured text is probably pretty easy, since 
Zope has utilities for that (though I haven't figured out how to use them yet 
-- I just want a ST -> HTML filter -- I assume this will become clear on 
further inspection).

But for compatibility with many PHP forum-users' expectations, it would be 
nice to also support "BBCode" formatting. BBCode is a kind of simplified HTML:

[B]This is BBCode[/B]

Here, for example, is a URL: [url]http://narya.net[/url], and 
[i]this would be in italics[/i].  I can also make a link-style URL, like
[url=http://www.anansispaceworks.com]this[/url].

Paragraphs are generated by double-spacing, as in TeX or
structured text.

Obviously, this is NOT XML-compatible.  I tried searching Google and 
Sourceforge, but I only find PHP implementations. So, I thought I'd ask 
whether anyone here knows of a Python implementation. Alternatively, if it 
were really easy, I could maybe write one, but I'd need more information than 
I have now (maybe a suggestions as to the easiest approach -- I don't think I 
can use the XML support, leaving me with using re (?)).  Maybe the stripogram 
module could be modified to do this? 

Thanks for any pointers,
Terry


--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com

"Python takes the pain out of programming ...
            ... and Zope puts it back again."




More information about the Python-list mailing list