dzLib.js
 

Javascript UBB-parser

Description:
UBB-tags provide a method to forum-users, to use simple mark-up for their messages. This library provides a way to convert these tags to HTML, client-side that is.

The parser is in beta-stadium however. It seems everything is working allright. The todo-list includes: the [list] tag (at the moment, all tags need a closing-tag), smiley-support and generic syntax highlighting (like: [code=js]).
Currently supported tags: b, i, u, s, sub, sup, url, email, image/img, me, quote and code.

Download: code, view-source.
Targetted: all
Tested on: win32: ie6, OS X: ie5.1
Links: What are UBB tags, Open Source UBB editor, GoT composer

Usage

 
/*Sample code*/
//--| Create a new parser, no debugging
var oParser=new Parser(false);
alert( oParser.ubbParse('Some [b]marked-up[/b] strings with [i]emphasis[/i]') );
  

Live Demo

These buttons are TAB's →
(this option will window.confirm you for every step)

Update history

  • 1.01 (2005-01-24): Fixed a new-line bug for Firefox and Safari (thankx Ron Rademaker)
  • 1.00 (2002-02-25): Initial