HTML_BBCodeParser powered by Text_Wiki
| From: | bertrand Gugger | Date: | Fri, 12 Aug 2005 12:37:48 +0000 |
| Subject: | HTML_BBCodeParser powered by Text_Wiki | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-39334@lists.php.net to get a copy of this message | ||
Bonjour,
I'm very pleased to introduce to you the rewrite of HTML_BBCodeParser powered by Text_Wiki.
As the task of HTML_BBCodeParser is a subset of what Text_Wiki does,
the re-engineered class extends Text_Wiki_BBCode.
The class is now a single file wrapper around Text_Wiki reproducing strictly the previous interface.
It is 100% compatible for those having kept '[' and ']' for tags and accepting Xhtml. All the @public properties and methods are the same
The eventual future release could even be a 1.2, no need to go to 2.0 ...
The inclusion of PEAR has been made optional thru the definition of a constant.
The configuration is compatible with the previous one but gives access to all parser, renderer and format configuration of Text_Wiki:
* control css for each kind of rules
* all urls/image/email tags are configurable about what you accept (schemes, extensions ...)
* all rules-dedicated ones
* ...
Text_Wiki configuration is easy but huge, so the accent has been put on the ease to augment it after upgrade. Users should have no big problem to update it.
All configuration has been put in an .ini file, what makes the description the same time.
This technique and its methods should be back-ported to Text_Wiki as it kept a general way.
However , you can naturally pass directly the options as an array to the constructor.
Please note that URIs checking is derived from the new one I've put in Validate and which should be full conforming to the RFC2396 BNF and not its weak regexp.
Currently, you need to install/copy the package Text_Wiki from CVS with all parsers and renderers. Yes, it's really a bunch of bunches of files !
We (the Text_wiki team) currently discuss the next split of Text_Wiki among parsers/renderers,
so we should be able to offer in a close future some lighter subset of Text_Wiki.
(e.g. here only the BBCode parser and the Xhtml renderer)
You can still do it manually if needed...
You will find in the doc subfolder of Text_Wiki CVS all the material needed to make some evaluation:
* BBCodeParser.php : the re-engineered class,
(configuration methods should go up in parent:: in the next)
* BBCodeParser_V2.ini : the configuration file with all existing sections and keys,
* parser.php : that's a copy of the original example of HTML_BBCodeParser,
(modified lines are commented)
That's only a first pre-version, nothing yet perfect, please review and evaluate it!
I will appreciate any feedback, thanks in advance.
à+
--
bertrand "toggg" Gugger