From 08b53f14dfa10ee0a5fa7f8baf12993aef2f0a6c Mon Sep 17 00:00:00 2001
From: Akzhan Abdulin
Date: Mon, 19 Sep 2011 13:24:10 +0400
Subject: [PATCH] Syntax highlighing in readme.
---
README.md | 146 +++++++++++++++++++++++++++++++-----------------------
1 file changed, 83 insertions(+), 63 deletions(-)
diff --git a/README.md b/README.md
index 0ef1b8f..0ff34c7 100644
--- a/README.md
+++ b/README.md
@@ -23,19 +23,22 @@ and implemented for PHP 5.3.
## Public API
- $dumper = new PHPDumper();
- $dumper->registerVisitor('tag', new AutotagsVisitor());
- $dumper->registerFilter('javascript', new JavaScriptFilter());
- $dumper->registerFilter('cdata', new CDATAFilter());
- $dumper->registerFilter('php', new PHPFilter());
- $dumper->registerFilter('style', new CSSFilter());
+```php
+registerVisitor('tag', new AutotagsVisitor());
+$dumper->registerFilter('javascript', new JavaScriptFilter());
+$dumper->registerFilter('cdata', new CDATAFilter());
+$dumper->registerFilter('php', new PHPFilter());
+$dumper->registerFilter('style', new CSSFilter());
- // Initialize parser & Jade
- $parser = new Parser(new Lexer());
- $jade = new Jade($parser, $dumper);
+// Initialize parser & Jade
+$parser = new Parser(new Lexer());
+$jade = new Jade($parser, $dumper);
- // Parse a template (both string & file containers)
- echo $jade->render($template);
+// Parse a template (both string & file containers)
+echo $jade->render($template);
+```
## Syntax
@@ -165,17 +168,20 @@ Will output the _transitional_ doctype, however:
Will output html 5's doctype. Below are the doctypes
defined by default, which can easily be extended:
- $doctypes = array(
- '5' => '',
- 'xml' => '',
- 'default' => '',
- 'transitional' => '',
- 'strict' => '',
- 'frameset' => '',
- '1.1' => '',
- 'basic' => '',
- 'mobile' => ''
- );
+```php
+ '',
+ 'xml' => '',
+ 'default' => '',
+ 'transitional' => '',
+ 'strict' => '',
+ 'frameset' => '',
+ '1.1' => '',
+ 'basic' => '',
+ 'mobile' => ''
+);
+```
## Comments
@@ -197,17 +203,19 @@ Jade supports sharp comments (`//- COMMENT`). So jade block:
will be compiled into:
- "; ?>
-
-
-
-
-
-
- some text
-
-
-
+```php
+"; ?>
+
+
+
+
+
+
+ some text
+
+
+
+```
### HTML Comments
@@ -219,10 +227,12 @@ Jade supports HTML comments (`// comment`). So block:
will become:
-
-
- I like sandwiches!
-
+```html
+
+
+ I like sandwiches!
+
+```
As with multiline comments:
@@ -233,12 +243,14 @@ As with multiline comments:
that compile to:
-
+```html
+
+```
### IE Conditional Comments
@@ -250,11 +262,13 @@ Also, Jade supports IE conditional comments, so:
will be parsed to:
-
+```html
+
+```
## Filters
@@ -270,13 +284,15 @@ at the top of this document for available filters.
Renders:
-
-
-
+```php
+
+
+
+```
## Code
@@ -311,9 +327,11 @@ echo a return value, which is prefixed by `=`:
Which outputs
-
-
-
+```php
+
+
+
+```
### Code blocks
@@ -325,11 +343,13 @@ Also, Jade has Code Blocks, that supports basic PHP template syntax:
Will be rendered to:
-
+```php
+
+```
But don't forget about colons `:` after instructions start (`- if(true) :`).