Added the html definition lists

This commit is contained in:
Kashyap 2013-01-11 06:59:02 +05:30
parent 63a18c478c
commit 40f59da1f4
1 changed files with 553 additions and 379 deletions

432
README.md
View File

@ -391,9 +391,7 @@ Available Options:
directory. To use a different views directory:
</dd>
```ruby
set :views, settings.root + '/templates'
```
<pre>set :views, settings.root + '/templates'</pre>
<dd>
One important thing to remember is that you always have to reference
@ -419,15 +417,15 @@ to use (and to be thread-safe), you should simply require it first:
<table>
<tr>
<td>Dependency</td>
<td>[haml](http://haml.info/)</td>
<td><a href="http://haml.info/" title="haml">haml</a></td>
</tr>
<tr>
<td>File Extension</td>
<td>.haml</td>
<td><pre>.haml</pre></td>
</tr>
<tr>
<td>Example</td>
<td>haml :index, :format => :html5</td>
<td><pre>haml :index, :format => :html5</pre></td>
</tr>
</table>
@ -436,84 +434,157 @@ to use (and to be thread-safe), you should simply require it first:
<table>
<tr>
<td>Dependency</td>
<td>[erubis](http://www.kuwata-lab.com/erubis/) or erb (included in Ruby)</td>
<td>
<a href="http://www.kuwata-lab.com/erubis/" title="erubis">erubis</a>
or erb (included in Ruby)
</td>
</tr>
<tr>
<td>File Extensions</td>
<td>.erb, .rhtml or .erubis (Erubis only)</td>
<td><pre>.erb</pre>, <pre>.rhtml</pre> or <pre>.erubis</pre> (Erubis only)</td>
</tr>
<tr>
<td>Example</td>
<td>erb :index</td>
<td><pre>erb :index</pre></td>
</tr>
</table>
#### Builder Templates
```ruby
Dependency [builder](http://builder.rubyforge.org/)
File Extension .builder
Example builder { |xml| xml.em "hi" }
```
<table>
<tr>
<td>Dependency</td>
<td>
<a href="http://builder.rubyforge.org/" title="builder">builder</a>
</td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.builder</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>builder { |xml| xml.em "hi" }</pre></td>
</tr>
</table>
It also takes a block for inline templates (see example).
#### Nokogiri Templates
```ruby
Dependency [nokogiri](http://nokogiri.org/)
File Extension .nokogiri
Example nokogiri { |xml| xml.em "hi" }
```
<table>
<tr>
<td>Dependency</td>
<td><a href="http://nokogiri.org/" title="nokogiri">nokogiri</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.nokogiri</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>nokogiri { |xml| xml.e</td>m "hi" }</pre></td>
</tr>
</table>
It also takes a block for inline templates (see example).
#### Sass Templates
```ruby
Dependency [sass](http://sass-lang.com/)
File Extension .sass
Example sass :stylesheet, :style => :expanded
```
<table>
<tr>
<td>Dependency</td>
<td><a href="http://sass-lang.com/" title="sass">sass</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.sass</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>sass :stylesheet, :style => :expanded</pre></td>
</tr>
</table>
#### SCSS Templates
```ruby
Dependency [sass](http://sass-lang.com/)
File Extension .scss
Example scss :stylesheet, :style => :expanded
```
<table>
<tr>
<td>Dependency</td>
<td><a href="http://sass-lang.com/" title="sass">sass</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.scss</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>scss :stylesheet, :style => :expanded</pre></td>
</tr>
</table>
#### Less Templates
```ruby
Dependency [less](http://www.lesscss.org/)
File Extension .less
Example less :stylesheet
```
<table>
<tr>
<td>Dependency</td>
<td><a href="http://www.lesscss.org/" title="less">less</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.less</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>less :stylesheet</pre></td>
</tr>
</table>
#### Liquid Templates
```ruby
Dependency [liquid](http://www.liquidmarkup.org/)
File Extension .liquid
Example liquid :index, :locals => { :key => 'value' }
```
<table>
<tr>
<td>Dependency</td>
<td><a href="http://www.liquidmarkup.org/" title="liquid">liquid</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.liquid</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>liquid :index, :locals => { :key => 'value' }</pre></td>
</tr>
</table>
Since you cannot call Ruby methods (except for `yield`) from a Liquid
template, you almost always want to pass locals to it.
#### Markdown Templates
```ruby
Dependency [rdiscount](https://github.com/rtomayko/rdiscount),
[redcarpet](https://github.com/vmg/redcarpet),
[bluecloth](http://deveiate.org/projects/BlueCloth),
[kramdown](http://kramdown.rubyforge.org/) *or*
[maruku](http://maruku.rubyforge.org/)
File Extensions .markdown, .mkd and .md
Example markdown :index, :layout_engine => :erb
```
<table>
<tr>
<td>Dependency</td>
<td>
<ul>
<li><a href="https://github.com/rtomayko/rdiscount title="RDiscount">RDiscount</a></li>
<li><a href="https://github.com/vmg/redcarpet title="RedCarpet">RedCarpet</a></li>
<li><a href="http://deveiate.org/projects/BlueCloth title="BlueCloth">BlueCloth</a></li>
<li><a href="http://kramdown.rubyforge.org/" title="kramdown">kramdown</a></li>
<li><a href="http://maruku.rubyforge.org/" title="maruku">maruku</a></li>
</ul>
</td>
</tr>
<tr>
<td>File Extensions</td>
<td><pre>.markdown</pre>, <pre>.mkd</pre> and <pre>.md</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>markdown :index, :layout_engine => :erb</pre></td>
</tr>
</table>
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
engine:
@ -535,11 +606,21 @@ template than for the layout by passing the `:layout_engine` option.
#### Textile Templates
```ruby
Dependency [RedCloth](http://redcloth.org/)
File Extension .textile
Example textile :index, :layout_engine => :erb
```
<table>
<tr>
<td>Dependency</td>
<td><a href="http://redcloth.org/" title="RedCloth">RedCloth</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.textile</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>textile :index, :layout_engine => :erb</pre></td>
</tr>
</table>
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:
@ -561,11 +642,20 @@ template than for the layout by passing the `:layout_engine` option.
#### RDoc Templates
```ruby
Dependency [rdoc](http://rdoc.rubyforge.org/)
File Extension .rdoc
Example rdoc :README, :layout_engine => :erb
```
<table>
<tr>
<td>Dependency</td>
<td><a href="http://rdoc.rubyforge.org/" title="RDoc">RDoc</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.rdoc</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>rdoc :README, :layout_engine => :erb</pre></td>
</tr>
</table>
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:
@ -587,48 +677,93 @@ template than for the layout by passing the `:layout_engine` option.
#### Radius Templates
```ruby
Dependency [radius](http://radius.rubyforge.org/)
File Extension .radius
Example radius :index, :locals => { :key => 'value' }
```
<table>
<tr>
<td>Dependency</td>
<td><a href="http://radius.rubyforge.org/" title="Radius">Radius</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.radius</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>radius :index, :locals => { :key => 'value' }</pre></td>
</tr>
</table>
Since you cannot call Ruby methods directly from a Radius template, you almost
always want to pass locals to it.
#### Markaby Templates
```ruby
Dependency [markaby](http://markaby.github.com/)
File Extension .mab
Example markaby { h1 "Welcome!" }
```
<table>
<tr>
<td>Dependency</td>
<td><a href="http://markaby.github.com/" title="Markaby">Markaby</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.mab</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>markaby { h1 "Welcome!" }</pre></td>
</tr>
</table>
It also takes a block for inline templates (see example).
#### RABL Templates
```ruby
Dependency [rabl](https://github.com/nesquena/rabl)
File Extension .rabl
Example rabl :index
```
<table>
<tr>
<td>Dependency</td>
<td><a href="https://github.com/nesquena/rabl" title="Rabl">Rabl</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.rabl</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>rabl :index</pre></td>
</tr>
</table>
#### Slim Templates
```ruby
Dependency [slim](http://slim-lang.com/)
File Extension .slim
Example slim :index
```
<table>
<tr>
<td>Dependency</td>
<td><a href="http://slim-lang.com/" title="Slim Lang">Slim Lang</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.slim</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>slim :index</pre></td>
</tr>
</table>
#### Creole Templates
```ruby
Dependency [creole](https://github.com/minad/creole)
File Extension .creole
Example creole :wiki, :layout_engine => :erb
```
<table>
<tr>
<td>Dependency</td>
<td><a href="https://github.com/minad/creole" title="Creole">Creole</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.creole</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>creole :wiki, :layout_engine => :erb</pre></td>
</tr>
</table>
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:
@ -650,27 +785,55 @@ template than for the layout by passing the `:layout_engine` option.
#### CoffeeScript Templates
```ruby
Dependency [coffee-script][coffee] and a [way to execute javascript][execjs]
File Extension .coffee
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"
<table>
<tr>
<td>Dependency</td>
<td>
<a href="https://github.com/josh/ruby-coffee-script" title="Ruby CoffeeScript">
CoffeeScript
</a> and a
<a href="https://github.com/sstephenson/execjs/blob/master/README.md#readme" title="ExecJS">
way to execute javascript
</a>
</td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.coffee</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>coffee :index</pre></td>
</tr>
</table>
#### Yajl Templates
```ruby
Dependency [yajl-ruby](https://github.com/brianmario/yajl-ruby)
File Extension .yajl
Example yajl :index,
<table>
<tr>
<td>Dependency</td>
<td><a href="https://github.com/brianmario/yajl-ruby" title="yajl-ruby">yajl-ruby</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.yajl</pre></td>
</tr>
<tr>
<td>Example</td>
<td>
<pre>
yajl :index,
:locals => { :key => 'qux' },
:callback => 'present',
:variable => 'resource'
```
</pre>
</td>
</tr>
</table>
The template source is evaluated as a Ruby string, and the
resulting json variable is converted #to_json.
resulting json variable is converted using `#to_json`.
```ruby
json = { :foo => 'bar' }
@ -685,11 +848,21 @@ var resource = {"foo":"bar","baz":"qux"}; present(resource);
#### WLang Templates
```ruby
Dependency [wlang](https://github.com/blambeau/wlang/)
File Extension .wlang
Example wlang :index, :locals => { :key => 'value' }
```
<table>
<tr>
<td>Dependency</td>
<td><a href="https://github.com/blambeau/wlang/" title="wlang">wlang</a></td>
</tr>
<tr>
<td>File Extension</td>
<td><pre>.wlang</pre></td>
</tr>
<tr>
<td>Example</td>
<td><pre>wlang :index, :locals => { :key => 'value' }</pre></td>
</tr>
</table>
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.
@ -1374,8 +1547,8 @@ The options are:
</dt>disposition</dt>
<dd>
used for Content-Disposition, possible values: `nil` (default),
`:attachment` and `:inline`
used for Content-Disposition, possible value: <pre>nil</pre> (default),
<pre>:attachment</pre> and <pre>:inline</pre>
</dd>
<dt>length</dt>
@ -1641,19 +1814,20 @@ You can also hand in an array in order to disable a list of protections:
</dd>
<dd>
Enable if your app is running behind a reverse proxy that has not been set up
properly. Note that the `url` helper will still produce absolute URLs, unless you
pass in `false` as the second parameter.
properly. Note that the <pre>url</pre> helper will still produce absolute URLs, unless you
pass in <pre>false</pre> as the second parameter.
</dd>
<dd>Disabled per default.</dd>
<dt>add_charsets</dt>
<dd>
mime types the `content_type` helper will automatically add the charset info to.
mime types the <pre>content_type</pre> helper will automatically add the charset info to.
You should add to it rather than overriding this option:
</dd>
```ruby
<pre>
settings.add_charsets << "application/foobar"
```
</pre>
<dt>app_file</dt>
<dd>
@ -1665,14 +1839,14 @@ You can also hand in an array in order to disable a list of protections:
<dd>IP address to bind to (default: 0.0.0.0). Only used for built-in server.</dd>
<dt>default_encoding</dt>
<dd>encoding to assume if unknown (defaults to `"utf-8"`).</dd>
<dd>encoding to assume if unknown (defaults to <pre>"utf-8"</pre>).</dd>
<dt>dump_errors</dt>
<dd>display errors in the log.</dd>
<dt>environment</dt>
<dd>
current environment, defaults to `ENV['RACK_ENV']`, or `"development"` if
current environment, defaults to <pre>ENV['RACK_ENV']</pre>, or <pre>"development"</pre> if
not available.
</dd>
@ -1688,7 +1862,7 @@ You can also hand in an array in order to disable a list of protections:
<dt>method_override</dt>
<dd>
use `_method` magic to allow put/delete forms in browsers that
use <pre>_method</pre> magic to allow put/delete forms in browsers that
don't support it.
</dd>
@ -1697,22 +1871,22 @@ You can also hand in an array in order to disable a list of protections:
<dt>prefixed_redirects</dt>
<dd>
Whether or not to insert `request.script_name` into redirects if no
absolute path is given. That way `redirect '/foo'` would behave like
`redirect to('/foo')`. Disabled per default.
Whether or not to insert <pre>request.script_name</pre> into redirects if no
absolute path is given. That way <pre>redirect '/foo'</pre> would behave like
<pre>redirect to('/foo')</pre>. Disabled per default.
</dd>
<dt>protection</dt>
<dd>Whether or not to enable web attack protections. See protection section above.</dd>
<dt>public_dir</dt>
<dd>Alias for `public_folder`. See below.</dd>
<dd>Alias for <pre>public_folder</pre>. See below.</dd>
<dt>public_folder</dt>
<dd>
Path to the folder public files are served from. Only used if static
file serving is enabled (see `static` setting below). Inferred from
`app_file` setting if not set.
file serving is enabled (see <pre>static</pre> setting below). Inferred from
<pre>app_file</pre> setting if not set.
</dd>
<dt>reload_templates</dt>
@ -1722,13 +1896,13 @@ You can also hand in an array in order to disable a list of protections:
<dt>root</dt>
<dd>
Path to project root folder. Inferred from `app_file` setting if not set.
Path to project root folder. Inferred from <pre>app_file</pre> setting if not set.
</dd>
<dt>raise_errors</dt>
<dd>
raise exceptions (will stop application). Enabled by default when
`environment` is set to `"test"`, disabled otherwise.
<pre>environment</pre> is set to <pre>"test"</pre>, disabled otherwise.
</dd>
<dt>run</dt>
@ -1748,18 +1922,18 @@ You can also hand in an array in order to disable a list of protections:
<dt>sessions</dt>
<dd>
Enable cookie-based sessions support using `Rack::Session::Cookie`.
Enable cookie-based sessions support using <pre>Rack::Session::Cookie</pre>.
See 'Using Sessions' section for more information.
</dd>
<dt>show_exceptions</dt>
<dd>
Show a stack trace in the browser when an exception
happens. Enabled by default when `environment`
is set to `"development"`, disabled otherwise.
happens. Enabled by default when <pre>environment</pre>
is set to <pre>"development"</pre>, disabled otherwise.
</dd>
<dd>
Can also be set to `:after_handler` to trigger
Can also be set to <pre>:after_handler</pre> to trigger
app-specified error handling before showing a stack
trace in the browser.
</dd>
@ -1776,23 +1950,23 @@ You can also hand in an array in order to disable a list of protections:
<dt>static_cache_control</dt>
<dd>
When Sinatra is serving static files, set this to add
`Cache-Control` headers to the responses. Uses the
`cache_control` helper. Disabled by default.
<pre>Cache-Control</pre> headers to the responses. Uses the
<pre>cache_control</pre> helper. Disabled by default.
</dd>
<dd>
Use an explicit array when setting multiple values:
`set :static_cache_control, [:public, :max_age => 300]`
<pre>set :static_cache_control, [:public, :max_age => 300]</pre>
</dd>
<dt>threaded</dt>
<dd>
If set to `true`, will tell Thin to use `EventMachine.defer`
If set to <pre>true</pre>, will tell Thin to use <pre>EventMachine.defer</pre>
for processing the request.
</dd>
<dt>views**</dt>
<dt>views</dt>
<dd>
Path to the views folder. Inferred from `app_file` setting if
Path to the views folder. Inferred from <pre>app_filei</pre> setting if
not set.
</dd>
</dl>