| 1 |
= sfTextilePlugin = |
|---|
| 2 |
|
|---|
| 3 |
== Overview == |
|---|
| 4 |
|
|---|
| 5 |
sfTextile plugin is a Symfony plugin. It allows you to parse and convert text written with Textile syntax into HTML. |
|---|
| 6 |
|
|---|
| 7 |
Textile is a lightweight markup language originally developed by Dean Allen and billed as a "humane Web text generator". |
|---|
| 8 |
You can find more details about Textile thanks to [http://en.wikipedia.org/wiki/Textile_(markup_language) Wikipedia] and [http://textism.com/tools/textile/ Dean Allen]. |
|---|
| 9 |
|
|---|
| 10 |
== Installation == |
|---|
| 11 |
|
|---|
| 12 |
You can install sfTextile plugin via PEAR (recommended) package manager, via SVN repository or manually. |
|---|
| 13 |
|
|---|
| 14 |
=== PEAR installation === |
|---|
| 15 |
|
|---|
| 16 |
1. The easiest way to install sfTextile plugin is to use PEAR package manager. |
|---|
| 17 |
|
|---|
| 18 |
{{{ |
|---|
| 19 |
$ symfony plugin-install http://plugins.symfony-project.com/sfTextilePlugin |
|---|
| 20 |
}}} |
|---|
| 21 |
|
|---|
| 22 |
2. Now clear the cache with symfony clear-cache command |
|---|
| 23 |
|
|---|
| 24 |
{{{ |
|---|
| 25 |
$ symfony cc |
|---|
| 26 |
}}} |
|---|
| 27 |
|
|---|
| 28 |
=== SVN installation === |
|---|
| 29 |
|
|---|
| 30 |
1. Enter your `plugins/` directory |
|---|
| 31 |
2. Checkout the plugin from svn |
|---|
| 32 |
|
|---|
| 33 |
{{{ |
|---|
| 34 |
$ svn co http://svn.symfony-project.com/plugins/sfTextilePlugin/ |
|---|
| 35 |
}}} |
|---|
| 36 |
|
|---|
| 37 |
3. Now clear the cache with symfony clear-cache command |
|---|
| 38 |
|
|---|
| 39 |
{{{ |
|---|
| 40 |
$ symfony cc |
|---|
| 41 |
}}} |
|---|
| 42 |
|
|---|
| 43 |
=== Manual installation === |
|---|
| 44 |
|
|---|
| 45 |
1. Alternatively, if you don't have PEAR or SVN installed, you can download the latest package attached to this plugin's wiki page and extract it under your project's `plugins/` directory |
|---|
| 46 |
|
|---|
| 47 |
2. Now clear the cache with symfony clear-cache command |
|---|
| 48 |
|
|---|
| 49 |
{{{ |
|---|
| 50 |
$ symfony cc |
|---|
| 51 |
}}} |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
== Configuration == |
|---|
| 55 |
|
|---|
| 56 |
sfTextile plugin comes with 2 additional sf_ configuration properties. |
|---|
| 57 |
In most cases you don't need to change them but, if you do, here's a quick reference. |
|---|
| 58 |
|
|---|
| 59 |
1. `sf_textile_plugin_dir` holds sfTextilePlugin directory. By default its value is a folder called `sfTextile` within your default symfony project plugin directory. |
|---|
| 60 |
|
|---|
| 61 |
2. `sf_textile_parser_lib` holds the path to Textile parser library. |
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
''Note''. To change a configuration '''don't change sfTextile configuration file''' but overwrite the variable at application/module level via Symfony settings.yml configuration file or with `sfConfig::set()` statement. |
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
== Usage == |
|---|
| 68 |
|
|---|
| 69 |
sfTextile plugin provides both a PHP class and a new set of Helpers. |
|---|
| 70 |
Helpers are intended to be used only inside a Symfony template while the class can be instantiated and called everywhere in your Symfony application. |
|---|
| 71 |
|
|---|
| 72 |
=== sfTextile class === |
|---|
| 73 |
|
|---|
| 74 |
sfTextile class currently provides both static and not static methods to do basically the same things. |
|---|
| 75 |
In the future, not static methods will give you more power while static methods will exist only for the purpose of providing a quick way to parse and convert a text to HTML. |
|---|
| 76 |
|
|---|
| 77 |
For the moment, you just need to remember two methods. |
|---|
| 78 |
|
|---|
| 79 |
1. `sfTextile::doConvert($text)` converts a text to HTML and returns it |
|---|
| 80 |
|
|---|
| 81 |
2. `sfTextile::doConvertFile($file)` converts a file to HTML and returns it |
|---|
| 82 |
|
|---|
| 83 |
`sfTextile::doConvertFile()` may throw a `sfTextileException()` if `$file` doesn't exist or isn't readable. |
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
=== TextileHelpers === |
|---|
| 87 |
|
|---|
| 88 |
Before using TextileHelpers you need to load them with `use_helper` statement. |
|---|
| 89 |
|
|---|
| 90 |
{{{ |
|---|
| 91 |
<?php use_helper('Textile'); ?> |
|---|
| 92 |
}}} |
|---|
| 93 |
|
|---|
| 94 |
Now you can call available helpers in your template: |
|---|
| 95 |
1. `convert_textile_text($text)` |
|---|
| 96 |
2. `convert_textile_file($file)` |
|---|
| 97 |
3. `include_textile_text($text)` |
|---|
| 98 |
4. `include_textile_file($file)` |
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
== Changelog == |
|---|
| 102 |
|
|---|
| 103 |
2007-08-14: 0.2.0 alpha |
|---|
| 104 |
|
|---|
| 105 |
* Changed textile library to be more php5 compliant |
|---|
| 106 |
|
|---|
| 107 |
2007-08-12: 0.1.0 alpha |
|---|
| 108 |
|
|---|
| 109 |
* Initial release |
|---|
| 110 |
|
|---|
| 111 |
== Todo == |
|---|
| 112 |
|
|---|
| 113 |
* implement restricted text conversion (i.e. in user comments) |
|---|
| 114 |
|
|---|
| 115 |
== Contacts == |
|---|
| 116 |
|
|---|
| 117 |
If you have any questions or feedback feel free to contact me at [mailto:manuel@sonsof.net manuel@sonsof.net]. |
|---|
| 118 |
|
|---|
| 119 |
Please include sfTextilePlugin in the mail subject, this will help me tracking the conversation. |
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
== License == |
|---|
| 123 |
|
|---|
| 124 |
sfTextilePlugin is a Symfony plugin created by Manuel Dalla Lana, inspired by sfMarkdownPlugin created by Simone Carletti. |
|---|
| 125 |
[http://textile.thresholdstate.com/ classTextile] is a PHP class created by Alex Shiels. |
|---|
| 126 |
|
|---|
| 127 |
For the full copyright and license information, please view the LICENSE file that was distributed with this source code. |
|---|