sfGeshiFormatterPlugin - 0.5.1

a code formatter plugin for symfony

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
sfGeshiFormatterPlugin 0.5.1beta for sf 1.2sf 1.1 MIT
Plugin image
1
user
Sign-in
to change
your status

The sfGeshiFormatter is a symfony plugin that enables a bb code like syntax for nice code outputs using geshi http://qbnz.com/highlighter
for now, you need to have this pecl extension installed http://de3.php.net/manual/en/book.bbcode.php

sfGeshiFormatter Plugin

The sfGeshiFormatter is a symfony plugin that enables a bb code like syntax for nice code outputs using geshi http://qbnz.com/highlighter for now, you need to have this pecl extension installed http://de3.php.net/manual/en/book.bbcode.php

Installation

  • Install the plugin

    $ symfony plugin:install sfGeshiFormatterPlugin -s beta
    
  • Install the PECL Extension

a good installation guide can be found here:

http://de3.php.net/manual/en/book.bbcode.php

Usage

  • simply wrap your code blocks with [code=lang]//your code...[/code]

for supported languages look at the geshi project homepage at http://qbnz.com/highlighter/

* to beautify your text use the "Geshi" Helper and put your text into this function : geshi_beautify()

  $text =  <<<EOF

  this is normal text

  [code=php]

  /* A simple php script */

  $choice = $_GET['foo'];

  if ( $choice == 1 )

  {

    echo 'You like coffee!';

  }

  elseif ( $choice == 2 )

  {

    echo 'I said, "You like coffee!"';

  }

  echo ""Isn't coffee horrible though?"";

  [/code]

  normal text

  EOF;

*

  use_helper('Geshi');

  echo geshi_beautify($text);

TODO

  • tests
  • better geshi options support
  • other bbcode library (pear) support
  • other beautifier library support

Developers

Name Status Email
gravatar Robert Schönthal lead ten.xmg <<ta>> leizac

License

Show source

MIT http://www.symfony-project.com/license