Releases for sf 1.0
| Version |
License |
API |
Released |
|
0.2.2beta
|
MIT license |
0.2.2beta
|
05/08/2007 |
|
0.2.0beta
|
MIT license |
0.2.0beta
|
21/05/2007 |
Copyright (c) 2006-2007 Colin Williams
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Changelog for release 0.2.2 - 05/08/2007
Not available
Other releases
Release 0.2.2 - 05/08/2007
Not available
Release 0.2.0 - 21/05/2007
Not available
Release 0.1.0 - 24/10/2006
Not available
Installation for sf 1.0
php symfony plugin-install http://plugins.symfony-project.org/sfBBCodeParserPlugin
PEAR
Download the PEAR package
sfBBCodeParser plugin
The sfBBCodeParser plugin is a plugin which provides a powerful and extensible parser for the popular BBCode formatting syntax. It is designed with the possibility of extension in mind. This parser does not simply use regular expressions to replace the bbcodes-- it parses the entire string using a recursive parse method, and ensures that all tags that require closing tags are closed in the proper order, thereby ensuring XHTML-compliant output.
Installation
- Download the most recent package below
- Unzip into your plugins folder
Usage
The parse_bbcode helper is extremely easy to use:
This code snippet will parse the provided $string for any bbcodes currently in the database, replace the bbcodes with XHTML-formatted text, and echo that formatted text.
Config
The plugin provides a handful of default tags included. However, you can add more (or override the current ones) by creating a app/<yourapp>/config/bbcode.yml file. It uses the YAML format, which you should be familiar with. The structure of the file should be as follows:
tags:
b:
name: Bold # Name for your tag. Right now it does nothing.
help: Make the selected text bold # Description of the effect of the tag. Right now it too does nothing
tag: b # Tag to be matched. No spaces allowed. This needs to match the key for the whole tag (the line with 2 spaces), or strange things will happen.
pattern: <strong>${content}</strong> # The pattern to be used. ${content} will be replaced with the content of the tag. ex. [b]content[/b]
# ${attr} will be replaced with the attribute value. ex. [color=attr]content[/color]
selfclose: no # If the tag closes itself (ex. a horizontal rule), set this to true. Otherwise it's not needed. Self-closing tags should not have a closing tag.
...more tags here...
options:
openchar: '[' # Set this to whatever character you want to signal the opening of your tags
closechar: ']' # Set this to whatever character you want to signal the closing of your tags
The comments should explain it for the most part.
Notes
Right now the parser only supports the one attribute . I've seen a suggestion that it handle multiple attributes. Right now I don't feel like adding this in. Maybe in the future...
TODO