From faa789a71009a3e264a471ad7dbe81d7e0d80432 Mon Sep 17 00:00:00 2001 From: Valentin Starck Date: Sun, 15 Jan 2012 15:36:58 -0200 Subject: [PATCH] Added syntax highlight. --- README.markdown | 93 ++++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/README.markdown b/README.markdown index 730264f..d3e1aa3 100644 --- a/README.markdown +++ b/README.markdown @@ -9,73 +9,80 @@ Usage A quick example: - render('Hello {{planet}}', array('planet' => 'World!')); - // "Hello World!" - ?> +```php +render('Hello {{planet}}', array('planet' => 'World!')); +// "Hello World!" + +``` And a more in-depth example--this is the canonical Mustache template: - Hello {{name}} - You have just won ${{value}}! - {{#in_ca}} - Well, ${{taxed_value}}, after taxes. - {{/in_ca}} - +``` +Hello {{name}} +You have just won ${{value}}! +{{#in_ca}} +Well, ${{taxed_value}}, after taxes. +{{/in_ca}} +``` Along with the associated Mustache class: - value - ($this->value * 0.4); - } - - public $in_ca = true; + public function taxed_value() { + return $this->value - ($this->value * 0.4); } + public $in_ca = true; +} + +``` Render it like so: - render($template); - ?> +```php +render($template); +``` Here's the same thing, a different way: Create a view object--which could also be an associative array, but those don't do functions quite as well: - value - ($this->value * 0.4); - } - - public $in_ca = true; - } - ?> +```php +value - ($this->value * 0.4); + } + + public $in_ca = true; +} + +``` And render it: - render($template, $chris); - ?> - +```php +render($template, $chris); +``` Known Issues