Trying out code blocks instead of Rdoc tables
This commit is contained in:
parent
766c80f1af
commit
8d9442be52
163
README.md
163
README.md
|
@ -396,70 +396,86 @@ get('/') { markdown :index }
|
||||||
|
|
||||||
#### Haml Templates
|
#### Haml Templates
|
||||||
|
|
||||||
Dependency:: [haml](http://haml.info/)
|
```ruby
|
||||||
File Extension:: `.haml`
|
Dependency [haml](http://haml.info/)
|
||||||
Example:: `haml :index, :format => :html5`
|
File Extension .haml
|
||||||
|
Example haml :index, :format => :html5
|
||||||
|
```
|
||||||
|
|
||||||
#### Erb Templates
|
#### Erb Templates
|
||||||
|
|
||||||
Dependency:: [erubis](http://www.kuwata-lab.com/erubis/) or
|
```ruby
|
||||||
erb (included in Ruby)
|
Dependency [erubis](http://www.kuwata-lab.com/erubis/) or erb (included in Ruby)
|
||||||
File Extensions:: `.erb`, `.rhtml` or `.erubis` (Erubis only)
|
File Extensions .erb, .rhtml or .erubis (Erubis only)
|
||||||
Example:: `erb :index`
|
Example erb :index
|
||||||
|
```
|
||||||
|
|
||||||
#### Builder Templates
|
#### Builder Templates
|
||||||
|
|
||||||
Dependency:: [builder](http://builder.rubyforge.org/)
|
```ruby
|
||||||
File Extension:: `.builder`
|
Dependency [builder](http://builder.rubyforge.org/)
|
||||||
Example:: `builder { |xml| xml.em "hi" }`
|
File Extension .builder
|
||||||
|
Example builder { |xml| xml.em "hi" }
|
||||||
|
```
|
||||||
|
|
||||||
It also takes a block for inline templates (see example).
|
It also takes a block for inline templates (see example).
|
||||||
|
|
||||||
#### Nokogiri Templates
|
#### Nokogiri Templates
|
||||||
|
|
||||||
Dependency:: [nokogiri](http://nokogiri.org/)
|
```ruby
|
||||||
File Extension:: `.nokogiri`
|
Dependency [nokogiri](http://nokogiri.org/)
|
||||||
Example:: `nokogiri { |xml| xml.em "hi" }`
|
File Extension .nokogiri
|
||||||
|
Example nokogiri { |xml| xml.em "hi" }
|
||||||
|
```
|
||||||
|
|
||||||
It also takes a block for inline templates (see example).
|
It also takes a block for inline templates (see example).
|
||||||
|
|
||||||
#### Sass Templates
|
#### Sass Templates
|
||||||
|
|
||||||
Dependency:: [sass](http://sass-lang.com/)
|
```ruby
|
||||||
File Extension:: `.sass`
|
Dependency [sass](http://sass-lang.com/)
|
||||||
Example:: `sass :stylesheet, :style => :expanded`
|
File Extension .sass
|
||||||
|
Example sass :stylesheet, :style => :expanded
|
||||||
|
```
|
||||||
|
|
||||||
#### SCSS Templates
|
#### SCSS Templates
|
||||||
|
|
||||||
Dependency:: [sass](http://sass-lang.com/)
|
```ruby
|
||||||
File Extension:: `.scss`
|
Dependency [sass](http://sass-lang.com/)
|
||||||
Example:: `scss :stylesheet, :style => :expanded`
|
File Extension .scss
|
||||||
|
Example scss :stylesheet, :style => :expanded
|
||||||
|
```
|
||||||
|
|
||||||
#### Less Templates
|
#### Less Templates
|
||||||
|
|
||||||
Dependency:: [less](http://www.lesscss.org/)
|
```ruby
|
||||||
File Extension:: `.less`
|
Dependency [less](http://www.lesscss.org/)
|
||||||
Example:: `less :stylesheet`
|
File Extension .less
|
||||||
|
Example less :stylesheet
|
||||||
|
```
|
||||||
|
|
||||||
#### Liquid Templates
|
#### Liquid Templates
|
||||||
|
|
||||||
Dependency:: [liquid](http://www.liquidmarkup.org/)
|
```ruby
|
||||||
File Extension:: `.liquid`
|
Dependency [liquid](http://www.liquidmarkup.org/)
|
||||||
Example:: `liquid :index, :locals => { :key => 'value' }`
|
File Extension .liquid
|
||||||
|
Example liquid :index, :locals => { :key => 'value' }
|
||||||
|
```
|
||||||
|
|
||||||
Since you cannot call Ruby methods (except for `yield`) from a Liquid
|
Since you cannot call Ruby methods (except for `yield`) from a Liquid
|
||||||
template, you almost always want to pass locals to it.
|
template, you almost always want to pass locals to it.
|
||||||
|
|
||||||
#### Markdown Templates
|
#### Markdown Templates
|
||||||
|
|
||||||
Dependency:: [rdiscount](https://github.com/rtomayko/rdiscount),
|
```ruby
|
||||||
|
Dependency [rdiscount](https://github.com/rtomayko/rdiscount),
|
||||||
[redcarpet](https://github.com/vmg/redcarpet),
|
[redcarpet](https://github.com/vmg/redcarpet),
|
||||||
[bluecloth](http://deveiate.org/projects/BlueCloth),
|
[bluecloth](http://deveiate.org/projects/BlueCloth),
|
||||||
[kramdown](http://kramdown.rubyforge.org/) *or*
|
[kramdown](http://kramdown.rubyforge.org/) *or*
|
||||||
[maruku](http://maruku.rubyforge.org/)
|
[maruku](http://maruku.rubyforge.org/)
|
||||||
File Extensions:: `.markdown`, `.mkd` and `.md`
|
File Extensions .markdown, .mkd and .md
|
||||||
Example:: `markdown :index, :layout_engine => :erb`
|
Example markdown :index, :layout_engine => :erb
|
||||||
|
```
|
||||||
It is not possible to call methods from markdown, nor to pass locals to it.
|
It is not possible to call methods from markdown, nor to pass locals to it.
|
||||||
You therefore will usually use it in combination with another rendering
|
You therefore will usually use it in combination with another rendering
|
||||||
engine:
|
engine:
|
||||||
|
@ -481,9 +497,11 @@ template than for the layout by passing the `:layout_engine` option.
|
||||||
|
|
||||||
#### Textile Templates
|
#### Textile Templates
|
||||||
|
|
||||||
Dependency:: [RedCloth](http://redcloth.org/)
|
```ruby
|
||||||
File Extension:: `.textile`
|
Dependency [RedCloth](http://redcloth.org/)
|
||||||
Example:: `textile :index, :layout_engine => :erb`
|
File Extension .textile
|
||||||
|
Example textile :index, :layout_engine => :erb
|
||||||
|
```
|
||||||
|
|
||||||
It is not possible to call methods from textile, nor to pass locals to it. You
|
It is not possible to call methods from textile, nor to pass locals to it. You
|
||||||
therefore will usually use it in combination with another rendering engine:
|
therefore will usually use it in combination with another rendering engine:
|
||||||
|
@ -505,9 +523,11 @@ template than for the layout by passing the `:layout_engine` option.
|
||||||
|
|
||||||
#### RDoc Templates
|
#### RDoc Templates
|
||||||
|
|
||||||
Dependency:: [rdoc](http://rdoc.rubyforge.org/)
|
```ruby
|
||||||
File Extension:: `.rdoc`
|
Dependency [rdoc](http://rdoc.rubyforge.org/)
|
||||||
Example:: `rdoc :README, :layout_engine => :erb`
|
File Extension .rdoc
|
||||||
|
Example rdoc :README, :layout_engine => :erb
|
||||||
|
```
|
||||||
|
|
||||||
It is not possible to call methods from rdoc, nor to pass locals to it. You
|
It is not possible to call methods from rdoc, nor to pass locals to it. You
|
||||||
therefore will usually use it in combination with another rendering engine:
|
therefore will usually use it in combination with another rendering engine:
|
||||||
|
@ -529,38 +549,48 @@ template than for the layout by passing the `:layout_engine` option.
|
||||||
|
|
||||||
#### Radius Templates
|
#### Radius Templates
|
||||||
|
|
||||||
Dependency:: [radius](http://radius.rubyforge.org/)
|
```ruby
|
||||||
File Extension:: `.radius`
|
Dependency [radius](http://radius.rubyforge.org/)
|
||||||
Example:: `radius :index, :locals => { :key => 'value' }`
|
File Extension .radius
|
||||||
|
Example radius :index, :locals => { :key => 'value' }
|
||||||
|
```
|
||||||
|
|
||||||
Since you cannot call Ruby methods directly from a Radius template, you almost
|
Since you cannot call Ruby methods directly from a Radius template, you almost
|
||||||
always want to pass locals to it.
|
always want to pass locals to it.
|
||||||
|
|
||||||
### Markaby Templates
|
#### Markaby Templates
|
||||||
|
|
||||||
Dependency:: [markaby](http://markaby.github.com/)
|
```ruby
|
||||||
File Extension:: `.mab`
|
Dependency [markaby](http://markaby.github.com/)
|
||||||
Example:: `markaby { h1 "Welcome!" }`
|
File Extension .mab
|
||||||
|
Example markaby { h1 "Welcome!" }
|
||||||
|
```
|
||||||
|
|
||||||
It also takes a block for inline templates (see example).
|
It also takes a block for inline templates (see example).
|
||||||
|
|
||||||
#### RABL Templates
|
#### RABL Templates
|
||||||
|
|
||||||
Dependency:: [rabl](https://github.com/nesquena/rabl)
|
```ruby
|
||||||
File Extension:: `.rabl`
|
Dependency [rabl](https://github.com/nesquena/rabl)
|
||||||
Example:: `rabl :index`
|
File Extension .rabl
|
||||||
|
Example rabl :index
|
||||||
|
```
|
||||||
|
|
||||||
#### Slim Templates
|
#### Slim Templates
|
||||||
|
|
||||||
Dependency:: [slim](http://slim-lang.com/)
|
```ruby
|
||||||
File Extension:: `.slim`
|
Dependency [slim](http://slim-lang.com/)
|
||||||
Example:: `slim :index`
|
File Extension .slim
|
||||||
|
Example slim :index
|
||||||
|
```
|
||||||
|
|
||||||
#### Creole Templates
|
#### Creole Templates
|
||||||
|
|
||||||
Dependency:: [creole](https://github.com/minad/creole)
|
```ruby
|
||||||
File Extension:: `.creole`
|
Dependency [creole](https://github.com/minad/creole)
|
||||||
Example:: `creole :wiki, :layout_engine => :erb`
|
File Extension .creole
|
||||||
|
Example creole :wiki, :layout_engine => :erb
|
||||||
|
```
|
||||||
|
|
||||||
It is not possible to call methods from creole, nor to pass locals to it. You
|
It is not possible to call methods from creole, nor to pass locals to it. You
|
||||||
therefore will usually use it in combination with another rendering engine:
|
therefore will usually use it in combination with another rendering engine:
|
||||||
|
@ -582,16 +612,24 @@ template than for the layout by passing the `:layout_engine` option.
|
||||||
|
|
||||||
#### CoffeeScript Templates
|
#### CoffeeScript Templates
|
||||||
|
|
||||||
Dependency:: [coffee-script](https://github.com/josh/ruby-coffee-script)
|
```ruby
|
||||||
and a [way to execute javascript](https://github.com/sstephenson/execjs/blob/master/README.md#readme)
|
Dependency [coffee-script][coffee] and a [way to execute javascript][execjs]
|
||||||
File Extension:: `.coffee`
|
File Extension .coffee
|
||||||
Example:: `coffee :index`
|
Example:: coffee :index
|
||||||
|
```
|
||||||
|
[coffee]: https://github.com/josh/ruby-coffee-script "Ruby Coffee Script"
|
||||||
|
[execjs]: https://github.com/sstephenson/execjs/blob/master/README.md#readme "ExecJS Readme"
|
||||||
|
|
||||||
#### Yajl Templates
|
#### Yajl Templates
|
||||||
|
|
||||||
Dependency:: [yajl-ruby](https://github.com/brianmario/yajl-ruby)
|
```ruby
|
||||||
File Extension:: `.yajl`
|
Dependency [yajl-ruby](https://github.com/brianmario/yajl-ruby)
|
||||||
Example:: `yajl :index, :locals => { :key => 'qux' }, :callback => 'present', :variable => 'resource' `
|
File Extension .yajl
|
||||||
|
Example yajl :index,
|
||||||
|
:locals => { :key => 'qux' },
|
||||||
|
:callback => 'present',
|
||||||
|
:variable => 'resource'
|
||||||
|
```
|
||||||
|
|
||||||
The template source is evaluated as a Ruby string, and the
|
The template source is evaluated as a Ruby string, and the
|
||||||
resulting json variable is converted #to_json.
|
resulting json variable is converted #to_json.
|
||||||
|
@ -609,10 +647,11 @@ var resource = {"foo":"bar","baz":"qux"}; present(resource);
|
||||||
|
|
||||||
#### WLang Templates
|
#### WLang Templates
|
||||||
|
|
||||||
Dependency:: [wlang](https://github.com/blambeau/wlang/)
|
```ruby
|
||||||
File Extension:: `.wlang`
|
Dependency [wlang](https://github.com/blambeau/wlang/)
|
||||||
Example:: `wlang :index, :locals => { :key => 'value' }`
|
File Extension .wlang
|
||||||
|
Example wlang :index, :locals => { :key => 'value' }
|
||||||
|
```
|
||||||
Since calling ruby methods is not idiomatic in wlang, you almost always want to pass locals
|
Since calling ruby methods is not idiomatic in wlang, you almost always want to pass locals
|
||||||
to it. Layouts written in wlang and `yield` are supported, though.
|
to it. Layouts written in wlang and `yield` are supported, though.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue