[Tickets #7285] Proposal for new Horde_Text_BBCode package

bugs at horde.org bugs at horde.org
Fri Sep 5 01:04:34 UTC 2008


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/7285
------------------------------------------------------------------------------
  Ticket             | 7285
  Created By         | webmaster at dasourcerer.net
  Summary            | Proposal for new Horde_Text_BBCode package
  Queue              | Horde Framework Packages
  Version            | HEAD
  Type               | Enhancement
  State              | New
  Priority           | 1. Low
  Milestone          |
  Patch              | 1
  Owners             |
+New Attachment     | Horde_Text_BBCode.zip
------------------------------------------------------------------------------


webmaster at dasourcerer.net (2008-09-04 21:04) wrote:

Hello,

a few moths ago  announced I were writing on a new tree based BBCode  
parser with
focus on XHTML 1.0. I also thought it were a great replacement for the current
Text_Filter_BBCode package. After much thought though, I decided to  
leave the new
parser out of Text_Filter as it isn't really stackable. This parser  
has been written to be
widely self sustainable (which means it only requires PHP5 and PCRE to  
run). This
also means it isn't really stackable with other packages out of  
Text_Filter. The only sane thing to do were probably to stack the XSS  
filter on top of it...

Some of the parsers features are:
  - Configurable set of supported tags (all tags can still be  
registered at once very easy)
  - Good recognition of free standing links
  - The parser makes a difference between BBCode instructions, text  
and links which
    means only things that are meant to be replaced will be replaced
  - No links within links will be created
  - Thumbnail creation for the [img] tag is available
  - Syntax highlighting for the [code] tag is available
  - automagic closing of unclosed tags
  - Correction of incorrectly nested BBCode instructions

The known or suspected issues so far are:
  - If multiple nested BBCode instructions are closed in the wrong  
order, the closing
    instructions might be displayed. Everything is nested correctly at  
(X)HTML level
    though. So this is just slightly annoying.
  - Lists tend to be a bit pesky at times. it might be possible to  
trick the parser into
    generating invalid XHTML.
  - There might be some issues with UTF-16 characters. UTF-8/BMP chars are fine
    so far. I just haven#t tested this yet

Future features might be:
  - Keyword highlighting
  - XHTML 1.0 Strict compliance
    XHTML 1.1 is out of the scope as this would make it very hard to  
place images
    within links, which is a very popular feature...
  - A notification interface
    The parser is very robust... and silent atm. If something fails  
somewhere, the parser
    will take care of it on its own and will silently use fallback  
routines or default
    settings. While this is great for stability, it is a royal pain to  
figure out why a certain
    setting is having no effect at all because the parser figured  
somethign were wrong

So, my own feeling is that the code has reached beta quality and I am  
going to use it
in production soon. I think it were a great addition to Horde 4 /  
Agora as it does a lot
of things differently than other parsers and is still quite efficient  
(e.g. it outperforms
PEAR::Text_Wiki_BBCode in terms of speed and memory usage).

A few, final words regarding the attached archive:
  - There is a set of phpDoc generated documentation. I included it  
for convenience
    as phpDoc seems to have some issues with the tutorial.
  - There are currently no tests for this package. As I started it, I  
had a bunch of .phpt
    tests. But the interface has changed a lot since then so I decided  
writing new tests
    using PHPUnit now.
  - The provided interactive example is a bit buggy, so do not take it  
as a measurement
    for the maturity of the code. (Specifically this fails for all  
settings that are controlled
    by a checkbox. And yes, it is as silly as it sounds).

Well then, have fun :)





More information about the bugs mailing list