tilt 2.0.8 → 2.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/tilt/commonmarker.rb +68 -1
- data/lib/tilt/csv.rb +1 -1
- data/lib/tilt/erb.rb +7 -1
- data/lib/tilt/haml.rb +2 -2
- data/lib/tilt/pandoc.rb +23 -15
- data/lib/tilt/redcarpet.rb +5 -2
- data/lib/tilt/rst-pandoc.rb +12 -7
- data/lib/tilt/sass.rb +40 -3
- data/lib/tilt/template.rb +18 -12
- data/lib/tilt.rb +2 -1
- metadata +8 -110
- data/CHANGELOG.md +0 -127
- data/Gemfile +0 -65
- data/HACKING +0 -16
- data/README.md +0 -233
- data/Rakefile +0 -106
- data/docs/TEMPLATES.md +0 -555
- data/docs/common.css +0 -14
- data/man/index.txt +0 -2
- data/man/tilt.1.ronn +0 -59
- data/test/markaby/locals.mab +0 -1
- data/test/markaby/markaby.mab +0 -1
- data/test/markaby/markaby_other_static.mab +0 -1
- data/test/markaby/render_twice.mab +0 -1
- data/test/markaby/scope.mab +0 -1
- data/test/markaby/yielding.mab +0 -2
- data/test/mytemplate.rb +0 -2
- data/test/test_helper.rb +0 -64
- data/test/tilt_asciidoctor_test.rb +0 -50
- data/test/tilt_babeltemplate.rb +0 -33
- data/test/tilt_blueclothtemplate_test.rb +0 -33
- data/test/tilt_buildertemplate_test.rb +0 -72
- data/test/tilt_cache_test.rb +0 -43
- data/test/tilt_coffeescripttemplate_test.rb +0 -141
- data/test/tilt_commonmarkertemplate_test.rb +0 -20
- data/test/tilt_compilesite_test.rb +0 -51
- data/test/tilt_creoletemplate_test.rb +0 -24
- data/test/tilt_csv_test.rb +0 -77
- data/test/tilt_erbtemplate_test.rb +0 -239
- data/test/tilt_erubistemplate_test.rb +0 -151
- data/test/tilt_erubitemplate_test.rb +0 -158
- data/test/tilt_etannitemplate_test.rb +0 -174
- data/test/tilt_hamltemplate_test.rb +0 -166
- data/test/tilt_kramdown_test.rb +0 -20
- data/test/tilt_lesstemplate_test.less +0 -1
- data/test/tilt_lesstemplate_test.rb +0 -42
- data/test/tilt_liquidtemplate_test.rb +0 -87
- data/test/tilt_livescripttemplate_test.rb +0 -37
- data/test/tilt_mapping_test.rb +0 -232
- data/test/tilt_markaby_test.rb +0 -88
- data/test/tilt_markdown_test.rb +0 -186
- data/test/tilt_marukutemplate_test.rb +0 -36
- data/test/tilt_metadata_test.rb +0 -42
- data/test/tilt_nokogiritemplate_test.rb +0 -87
- data/test/tilt_pandoctemplate_test.rb +0 -67
- data/test/tilt_prawntemplate.prawn +0 -1
- data/test/tilt_prawntemplate_test.rb +0 -75
- data/test/tilt_radiustemplate_test.rb +0 -75
- data/test/tilt_rdiscounttemplate_test.rb +0 -43
- data/test/tilt_rdoctemplate_test.rb +0 -29
- data/test/tilt_redcarpettemplate_test.rb +0 -54
- data/test/tilt_redclothtemplate_test.rb +0 -36
- data/test/tilt_rstpandoctemplate_test.rb +0 -32
- data/test/tilt_sasstemplate_test.rb +0 -41
- data/test/tilt_sigil_test.rb +0 -41
- data/test/tilt_stringtemplate_test.rb +0 -171
- data/test/tilt_template_test.rb +0 -314
- data/test/tilt_test.rb +0 -60
- data/test/tilt_typescript_test.rb +0 -38
- data/test/tilt_wikiclothtemplate_test.rb +0 -32
- data/test/tilt_yajltemplate_test.rb +0 -101
- data/tilt.gemspec +0 -130
data/docs/TEMPLATES.md
DELETED
@@ -1,555 +0,0 @@
|
|
1
|
-
Tilt Templates
|
2
|
-
==============
|
3
|
-
|
4
|
-
(See <https://github.com/rtomayko/tilt/blob/master/docs/TEMPLATES.md> for a rendered,
|
5
|
-
HTML-version of this file).
|
6
|
-
|
7
|
-
While all Tilt templates use the same basic interface for template loading and
|
8
|
-
evaluation, each varies in its capabilities and available options. Detailed
|
9
|
-
documentation on each supported template engine is provided below.
|
10
|
-
|
11
|
-
There are also some file extensions that have several implementations
|
12
|
-
(currently ERB and Markdown). These template classes have certain features
|
13
|
-
which are guaranteed to work across all the implementations. If you wish to be
|
14
|
-
compatible with all of these template classes, you should only depend on the
|
15
|
-
cross-implementation features.
|
16
|
-
|
17
|
-
* [ERB](#erb) - Generic ERB implementation (backed by erb.rb or Erubis)
|
18
|
-
* [erb.rb](#erbrb) - `Tilt::ERBTemplate`
|
19
|
-
* [Erubis](#erubis) - `Tilt::ErubisTemplate`
|
20
|
-
* [Haml](#haml) - `Tilt::HamlTemplate`
|
21
|
-
* [Liquid](#liquid) - `Tilt::LiquidTemplate`
|
22
|
-
* Nokogiri - `Tilt::NokogiriTemplate`
|
23
|
-
* Builder - `Tilt::BuilderTemplate`
|
24
|
-
* Markaby - `Tilt::MarkabyTemplate`
|
25
|
-
* [Radius](#radius) - `Tilt::RadiusTemplate`
|
26
|
-
|
27
|
-
Tilt also includes support for CSS processors like [LessCSS][lesscss] and
|
28
|
-
[Sass][sass], [CoffeeScript][coffee-script] and some simple text formats.
|
29
|
-
|
30
|
-
* Less - `Tilt::LessTemplate`
|
31
|
-
* Sass - `Tilt::SassTemplate`
|
32
|
-
* Scss - `Tilt::ScssTemplate`
|
33
|
-
* CoffeeScript - `Tilt::CoffeeScriptTemplate`
|
34
|
-
* Literate CoffeeScript - `Tilt::CoffeeScriptLiterateTemplate`
|
35
|
-
* LiveScript - `Tilt::LiveScriptTemplate`
|
36
|
-
* [Textile](#redcloth) - `Tilt::RedClothTemplate`
|
37
|
-
* reStructuredText - `Tilt::RstPandocTemplate`
|
38
|
-
* Creole - `Tilt::CreoleTemplate`
|
39
|
-
* [RDoc](#rdoc) - `Tilt::RDocTemplate`
|
40
|
-
|
41
|
-
Tilt has extensive support for Markdown, backed by one of seven different
|
42
|
-
implementations (depending on which are available on your system):
|
43
|
-
|
44
|
-
* [Markdown](#markdown) - Generic Markdown implementation
|
45
|
-
* [RDiscount](#rdiscount) - `Tilt::RDiscountTemplate`
|
46
|
-
* Redcarpet - `Tilt::RedcarpetTemplate`
|
47
|
-
* BlueCloth - `Tilt::BlueClothTemplate`
|
48
|
-
* Kramdown - `Tilt::KramdownTemplate`
|
49
|
-
* Pandoc - `Tilt::PandocTemplate`
|
50
|
-
* CommonMarker - `Tilt::CommonMarkerTemplate`
|
51
|
-
* Maruku - `Tilt::MarukuTemplate`
|
52
|
-
|
53
|
-
<a name='erb'></a>
|
54
|
-
ERB (`erb`, `rhtml`)
|
55
|
-
--------------------
|
56
|
-
|
57
|
-
ERB is a simple but powerful template languge for Ruby. In Tilt it's backed by
|
58
|
-
[Erubis](#erubis) (if installed on your system) or by [erb.rb](#erbrb) (which
|
59
|
-
is included in Ruby's standard library). This documentation applies to both
|
60
|
-
implementations.
|
61
|
-
|
62
|
-
### Example
|
63
|
-
|
64
|
-
Hello <%= world %>!
|
65
|
-
|
66
|
-
### Usage
|
67
|
-
|
68
|
-
ERB templates support custom evaluation scopes and locals:
|
69
|
-
|
70
|
-
>> require 'erb'
|
71
|
-
>> template = Tilt.new('hello.html.erb')
|
72
|
-
>> template.render(self, :world => 'World!')
|
73
|
-
=> "Hello World!"
|
74
|
-
|
75
|
-
Or, use `Tilt['erb']` directly to process strings:
|
76
|
-
|
77
|
-
template = Tilt['erb'].new { "Hello <%= world %>!" }
|
78
|
-
template.render(self, :world => 'World!')
|
79
|
-
|
80
|
-
### Options
|
81
|
-
|
82
|
-
#### `:trim => trim`
|
83
|
-
|
84
|
-
Omits newlines and spaces around certain lines (usually those that starts with
|
85
|
-
`<%` and ends with `%>`). There isn't a specification for how trimming in ERB
|
86
|
-
should work, so if you need more control over the whitespace, you should use
|
87
|
-
[erb.rb](#erbrb) or [Erubis](#erubis) directly.
|
88
|
-
|
89
|
-
|
90
|
-
#### `:outvar => '_erbout'`
|
91
|
-
|
92
|
-
The name of the variable used to accumulate template output. This can be
|
93
|
-
any valid Ruby expression but must be assignable. By default a local
|
94
|
-
variable named `_erbout` is used.
|
95
|
-
|
96
|
-
<a name='erbrb'></a>
|
97
|
-
erb.rb (`erb`, `rhtml`)
|
98
|
-
-----------------------
|
99
|
-
|
100
|
-
[ERB](#erb) implementation available in Ruby's standard library.
|
101
|
-
|
102
|
-
All the documentation of [ERB](#erb) applies in addition to the following:
|
103
|
-
|
104
|
-
### Usage
|
105
|
-
|
106
|
-
The `Tilt::ERBTemplate` class is registered for all files ending in `.erb` or
|
107
|
-
`.rhtml` by default, but with a *lower* priority than ErubisTemplate. If you
|
108
|
-
specifically want to use ERB, it's recommended to use `#prefer`:
|
109
|
-
|
110
|
-
Tilt.prefer Tilt::ERBTemplate
|
111
|
-
|
112
|
-
__NOTE:__ It's suggested that your program `require 'erb'` at load time when
|
113
|
-
using this template engine within a threaded environment.
|
114
|
-
|
115
|
-
### Options
|
116
|
-
|
117
|
-
#### `:trim => true`
|
118
|
-
|
119
|
-
The ERB trim mode flags. This is a string consisting of any combination of the
|
120
|
-
following characters:
|
121
|
-
|
122
|
-
* `'>'` omits newlines for lines ending in `>`
|
123
|
-
* `'<>'` omits newlines for lines starting with `<%` and ending in `%>`
|
124
|
-
* `'%'` enables processing of lines beginning with `%`
|
125
|
-
* `true` is an alias of `<>`
|
126
|
-
|
127
|
-
#### `:safe => nil`
|
128
|
-
|
129
|
-
The `$SAFE` level; when set, ERB code will be run in a
|
130
|
-
separate thread with `$SAFE` set to the provided level.
|
131
|
-
|
132
|
-
#### `:outvar => '_erbout'`
|
133
|
-
|
134
|
-
The name of the variable used to accumulate template output. This can be
|
135
|
-
any valid Ruby expression but must be assignable. By default a local
|
136
|
-
variable named `_erbout` is used.
|
137
|
-
|
138
|
-
### See also
|
139
|
-
|
140
|
-
* [ERB documentation](http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html)
|
141
|
-
|
142
|
-
|
143
|
-
<a name='erubis'></a>
|
144
|
-
Erubis (`erb`, `rhtml`, `erubis`)
|
145
|
-
---------------------------------
|
146
|
-
|
147
|
-
[Erubis][erubis] is a fast, secure, and very extensible implementation of [ERB](#erb).
|
148
|
-
|
149
|
-
All the documentation of [ERB](#erb) applies in addition to the following:
|
150
|
-
|
151
|
-
### Usage
|
152
|
-
|
153
|
-
The `Tilt::ErubisTemplate` class is registered for all files ending in `.erb` or
|
154
|
-
`.rhtml` by default, but with a *higher* priority than `ERBTemplate`. If you
|
155
|
-
specifically want to use Erubis, it's recommended to use `#prefer`:
|
156
|
-
|
157
|
-
Tilt.prefer Tilt::ErubisTemplate
|
158
|
-
|
159
|
-
__NOTE:__ It's suggested that your program `require 'erubis'` at load time when
|
160
|
-
using this template engine within a threaded environment.
|
161
|
-
|
162
|
-
### Options
|
163
|
-
|
164
|
-
#### `:engine_class => Erubis::Eruby`
|
165
|
-
|
166
|
-
Allows you to specify a custom engine class to use instead of the
|
167
|
-
default which is `Erubis::Eruby`.
|
168
|
-
|
169
|
-
#### `:escape_html => false`
|
170
|
-
|
171
|
-
When `true`, `Erubis::EscapedEruby` will be used as the engine class
|
172
|
-
instead of the default. All content within `<%= %>` blocks will be
|
173
|
-
automatically html escaped.
|
174
|
-
|
175
|
-
#### `:outvar => '_erbout'`
|
176
|
-
|
177
|
-
The name of the variable used to accumulate template output. This can be
|
178
|
-
any valid Ruby expression but must be assignable. By default a local
|
179
|
-
variable named `_erbout` is used.
|
180
|
-
|
181
|
-
#### `:pattern => '<% %>'`
|
182
|
-
|
183
|
-
Set pattern for embedded Ruby code.
|
184
|
-
|
185
|
-
#### `:trim => true`
|
186
|
-
|
187
|
-
Delete spaces around `<% %>`. (But, spaces around `<%= %>` are preserved.)
|
188
|
-
|
189
|
-
### See also
|
190
|
-
|
191
|
-
* [Erubis Home][erubis]
|
192
|
-
* [Erubis User's Guide](http://www.kuwata-lab.com/erubis/users-guide.html)
|
193
|
-
|
194
|
-
|
195
|
-
<a name='haml'></a>
|
196
|
-
Haml (`haml`)
|
197
|
-
-------------
|
198
|
-
|
199
|
-
[Haml][haml] is a markup language that’s used to cleanly and simply describe
|
200
|
-
the HTML of any web document without the use of inline code. Haml functions as
|
201
|
-
a replacement for inline page templating systems such as PHP, ASP, and ERB, the
|
202
|
-
templating language used in most Ruby on Rails applications. However, Haml
|
203
|
-
avoids the need for explicitly coding HTML into the template, because it itself
|
204
|
-
is a description of the HTML, with some code to generate dynamic content.
|
205
|
-
([more](http://haml.info/about.html))
|
206
|
-
|
207
|
-
|
208
|
-
### Example
|
209
|
-
|
210
|
-
%html
|
211
|
-
%head
|
212
|
-
%title= @title
|
213
|
-
%body
|
214
|
-
%h1
|
215
|
-
Hello
|
216
|
-
= world + '!'
|
217
|
-
|
218
|
-
### Usage
|
219
|
-
|
220
|
-
The `Tilt::HamlTemplate` class is registered for all files ending in `.haml`
|
221
|
-
by default. Haml templates support custom evaluation scopes and locals:
|
222
|
-
|
223
|
-
>> require 'haml'
|
224
|
-
>> template = Tilt.new('hello.haml')
|
225
|
-
=> #<Tilt::HamlTemplate @file='hello.haml'>
|
226
|
-
>> @title = "Hello Haml!"
|
227
|
-
>> template.render(self, :world => 'Haml!')
|
228
|
-
=> "
|
229
|
-
<html>
|
230
|
-
<head>
|
231
|
-
<title>Hello Haml!</title>
|
232
|
-
</head>
|
233
|
-
<body>
|
234
|
-
<h1>Hello Haml!</h1>
|
235
|
-
</body>
|
236
|
-
</html>"
|
237
|
-
|
238
|
-
Or, use the `Tilt::HamlTemplate` class directly to process strings:
|
239
|
-
|
240
|
-
>> require 'haml'
|
241
|
-
>> template = Tilt::HamlTemplate.new { "%h1= 'Hello Haml!'" }
|
242
|
-
=> #<Tilt::HamlTemplate @file=nil ...>
|
243
|
-
>> template.render
|
244
|
-
=> "<h1>Hello Haml!</h1>"
|
245
|
-
|
246
|
-
__NOTE:__ It's suggested that your program `require 'haml'` at load time when
|
247
|
-
using this template engine within a threaded environment.
|
248
|
-
|
249
|
-
### Options
|
250
|
-
|
251
|
-
Please see the [Haml Reference](http://haml.info/docs/yardoc/file.HAML_REFERENCE.html#options) for all available options.
|
252
|
-
|
253
|
-
### See also
|
254
|
-
|
255
|
-
* [#haml.docs](http://haml.info/docs.html)
|
256
|
-
* [Haml Tutorial](http://haml.info/tutorial.html)
|
257
|
-
* [Haml Reference](http://haml.info/docs/yardoc/file.HAML_REFERENCE.html)
|
258
|
-
|
259
|
-
|
260
|
-
<a name='liquid'></a>
|
261
|
-
Liquid (`liquid`)
|
262
|
-
-----------------
|
263
|
-
|
264
|
-
[Liquid][liquid] is for rendering safe templates which cannot affect the
|
265
|
-
security of the server they are rendered on.
|
266
|
-
|
267
|
-
### Example
|
268
|
-
|
269
|
-
<html>
|
270
|
-
<head>
|
271
|
-
<title>{{ title }}</title>
|
272
|
-
</head>
|
273
|
-
<body>
|
274
|
-
<h1>Hello {{ world }}!</h1>
|
275
|
-
</body>
|
276
|
-
</html>
|
277
|
-
|
278
|
-
### Usage
|
279
|
-
|
280
|
-
`Tilt::LiquidTemplate` is registered for all files ending in `.liquid` by
|
281
|
-
default. Liquid templates support locals and objects that respond to
|
282
|
-
`#to_h` as scopes:
|
283
|
-
|
284
|
-
>> require 'liquid'
|
285
|
-
>> require 'tilt'
|
286
|
-
>> template = Tilt.new('hello.liquid')
|
287
|
-
=> #<Tilt::LiquidTemplate @file='hello.liquid'>
|
288
|
-
>> scope = { :title => "Hello Liquid Templates" }
|
289
|
-
>> template.render(nil, :world => "Liquid")
|
290
|
-
=> "
|
291
|
-
<html>
|
292
|
-
<head>
|
293
|
-
<title>Hello Liquid Templates</title>
|
294
|
-
</head>
|
295
|
-
<body>
|
296
|
-
<h1>Hello Liquid!</h1>
|
297
|
-
</body>
|
298
|
-
</html>"
|
299
|
-
|
300
|
-
Or, use `Tilt::LiquidTemplate` directly to process strings:
|
301
|
-
|
302
|
-
>> require 'liquid'
|
303
|
-
>> template = Tilt::LiquidTemplate.new { "<h1>Hello Liquid!</h1>" }
|
304
|
-
=> #<Tilt::LiquidTemplate @file=nil ...>
|
305
|
-
>> template.render
|
306
|
-
=> "<h1>Hello Liquid!</h1>"
|
307
|
-
|
308
|
-
__NOTE:__ It's suggested that your program `require 'liquid'` at load
|
309
|
-
time when using this template engine within a threaded environment.
|
310
|
-
|
311
|
-
### See also
|
312
|
-
|
313
|
-
* [Liquid for Programmers](https://wiki.github.com/Shopify/liquid/liquid-for-programmers)
|
314
|
-
* [Liquid Docs](http://liquid.rubyforge.org/)
|
315
|
-
* GitHub: [Shopify/liquid](https://github.com/Shopify/liquid/)
|
316
|
-
|
317
|
-
|
318
|
-
<a name='radius'></a>
|
319
|
-
Radius (`radius`)
|
320
|
-
-----------------
|
321
|
-
|
322
|
-
[Radius][radius] is the template language used by [Radiant CMS][radiant]. It is
|
323
|
-
a tag language designed to be valid XML/HTML.
|
324
|
-
|
325
|
-
### Example
|
326
|
-
|
327
|
-
<html>
|
328
|
-
<body>
|
329
|
-
<h1><r:title /></h1>
|
330
|
-
<ul class="<r:type />">
|
331
|
-
<r:repeat times="3">
|
332
|
-
<li><r:hello />!</li>
|
333
|
-
</r:repeat>
|
334
|
-
</ul>
|
335
|
-
<r:yield />
|
336
|
-
</body>
|
337
|
-
</html>
|
338
|
-
|
339
|
-
### Usage
|
340
|
-
|
341
|
-
To render a template such as the one above.
|
342
|
-
|
343
|
-
scope = OpenStruct.new
|
344
|
-
scope.title = "Radius Example"
|
345
|
-
scope.hello = "Hello, World!"
|
346
|
-
|
347
|
-
require 'radius'
|
348
|
-
template = Tilt::RadiusTemplate.new('example.radius', :tag_prefix=>'r')
|
349
|
-
template.render(scope, :type=>'hlist'){ "Jackpot!" }
|
350
|
-
|
351
|
-
The result will be:
|
352
|
-
|
353
|
-
<html>
|
354
|
-
<body>
|
355
|
-
<h1>Radius Example</h1>
|
356
|
-
<ul class="hlist">
|
357
|
-
<li>Hello, World!</li>
|
358
|
-
<li>Hello, World!</li>
|
359
|
-
<li>Hello, World!</li>
|
360
|
-
</ul>
|
361
|
-
Jackpot!
|
362
|
-
</body>
|
363
|
-
</html>
|
364
|
-
|
365
|
-
### See also
|
366
|
-
|
367
|
-
* [Radius][radius]
|
368
|
-
* [Radiant CMS][radiant]
|
369
|
-
|
370
|
-
|
371
|
-
<a name='textile'></a>
|
372
|
-
Textile (`textile`)
|
373
|
-
-------------------
|
374
|
-
|
375
|
-
Textile is a lightweight markup language originally developed by Dean Allen and
|
376
|
-
billed as a "humane Web text generator". Textile converts its marked-up text
|
377
|
-
input to valid, well-formed XHTML and also inserts character entity references
|
378
|
-
for apostrophes, opening and closing single and double quotation marks,
|
379
|
-
ellipses and em dashes.
|
380
|
-
|
381
|
-
Textile formatted texts are converted to HTML with the [RedCloth][redcloth]
|
382
|
-
engine, which is a Ruby extension written in C.
|
383
|
-
|
384
|
-
### Example
|
385
|
-
|
386
|
-
h1. Hello Textile Templates
|
387
|
-
|
388
|
-
Hello World. This is a paragraph.
|
389
|
-
|
390
|
-
### Usage
|
391
|
-
|
392
|
-
__NOTE:__ It's suggested that your program `require 'redcloth'` at load time
|
393
|
-
when using this template engine in a threaded environment.
|
394
|
-
|
395
|
-
### See Also
|
396
|
-
|
397
|
-
* [RedCloth][redcloth]
|
398
|
-
|
399
|
-
<a name='rst'></a>
|
400
|
-
reStructuredText (`rst`)
|
401
|
-
-------------------
|
402
|
-
|
403
|
-
reStructuredText is a lightweight markup language originally developed by David Goodger,
|
404
|
-
based on StructuredText and Setext. reStructuredText is primarily used for technical
|
405
|
-
documentation in the Python programming language community, e.g. by the
|
406
|
-
[Sphinx](http://www.sphinx-doc.org/en/stable/rest.html) Python documentation generator.
|
407
|
-
|
408
|
-
reStructuredText formatted texts are converted to HTML with [Pandoc][pandoc], which
|
409
|
-
is an application written in Haskell, with a Ruby wrapper provided by the
|
410
|
-
[pandoc-ruby][pandoc-ruby] gem.
|
411
|
-
|
412
|
-
### Example
|
413
|
-
|
414
|
-
Hello Rst Templates
|
415
|
-
===================
|
416
|
-
|
417
|
-
Hello World. This is a paragraph.
|
418
|
-
|
419
|
-
### See Also
|
420
|
-
|
421
|
-
* [Pandoc][pandoc]
|
422
|
-
* [pandoc-ruby][pandoc-ruby]
|
423
|
-
|
424
|
-
|
425
|
-
<a name='rdoc'></a>
|
426
|
-
RDoc (`rdoc`)
|
427
|
-
-------------
|
428
|
-
|
429
|
-
[RDoc][rdoc] is the simple text markup system that comes with Ruby's standard
|
430
|
-
library.
|
431
|
-
|
432
|
-
### Example
|
433
|
-
|
434
|
-
= Hello RDoc Templates
|
435
|
-
|
436
|
-
Hello World. This is a paragraph.
|
437
|
-
|
438
|
-
### Usage
|
439
|
-
|
440
|
-
__NOTE:__ It's suggested that your program `require 'rdoc'`,
|
441
|
-
`require 'rdoc/markup'`, and `require 'rdoc/markup/to_html'` at load time
|
442
|
-
when using this template engine in a threaded environment.
|
443
|
-
|
444
|
-
### See also
|
445
|
-
|
446
|
-
* [RDoc][rdoc]
|
447
|
-
|
448
|
-
|
449
|
-
<a name='markdown'></a>
|
450
|
-
Markdown (`markdown`, `md`, `mkd`)
|
451
|
-
----------------------------------
|
452
|
-
|
453
|
-
[Markdown][markdown] is a lightweight markup language, created by John Gruber
|
454
|
-
and Aaron Swartz. For any markup that is not covered by Markdown’s syntax, HTML
|
455
|
-
is used. Marking up plain text with Markdown markup is easy and Markdown
|
456
|
-
formatted texts are readable.
|
457
|
-
|
458
|
-
Markdown formatted texts are converted to HTML with one of these libraries:
|
459
|
-
|
460
|
-
* [RDiscount](#rdiscount) - `Tilt::RDiscountTemplate`
|
461
|
-
* Redcarpet - `Tilt::RedcarpetTemplate`
|
462
|
-
* BlueCloth - `Tilt::BlueClothTemplate`
|
463
|
-
* Kramdown - `Tilt::KramdownTemplate`
|
464
|
-
* Pandoc - `Tilt::PandocTemplate`
|
465
|
-
* Maruku - `Tilt::MarukuTemplate`
|
466
|
-
|
467
|
-
Tilt will use fallback mode (as documented in the README) for determining which
|
468
|
-
library to use. RDiscount has highest priority - Maruku has lowest.
|
469
|
-
|
470
|
-
### Example
|
471
|
-
|
472
|
-
Hello Markdown Templates
|
473
|
-
========================
|
474
|
-
|
475
|
-
Hello World. This is a paragraph.
|
476
|
-
|
477
|
-
### Usage
|
478
|
-
|
479
|
-
To wrap a Markdown formatted document with a layout:
|
480
|
-
|
481
|
-
layout = Tilt['erb'].new do
|
482
|
-
"<!doctype html><title></title><%= yield %>"
|
483
|
-
end
|
484
|
-
data = Tilt['md'].new { "# hello tilt" }
|
485
|
-
layout.render { data.render }
|
486
|
-
# => "<!doctype html><title></title><h1>hello tilt</h1>\n"
|
487
|
-
|
488
|
-
### Options
|
489
|
-
|
490
|
-
Every implementation of Markdown *should* support these options, but there are
|
491
|
-
some known problems with the Kramdown and Maruku engines.
|
492
|
-
|
493
|
-
#### `:smartypants => true|false`
|
494
|
-
|
495
|
-
Set `true` to enable [Smarty Pants][smartypants] style punctuation replacement.
|
496
|
-
|
497
|
-
In Kramdown this option only applies to smart quotes. It will apply a
|
498
|
-
subset of Smarty Pants (e.g. `...` to `…`) regardless of any option.
|
499
|
-
|
500
|
-
Maruku ignores this option and always applies smart quotes (and nothing else).
|
501
|
-
|
502
|
-
#### `:escape_html => true|false`
|
503
|
-
|
504
|
-
Set `true` disallow raw HTML in Markdown contents. HTML is converted to
|
505
|
-
literal text by escaping `<` characters.
|
506
|
-
|
507
|
-
Kramdown and Maruku don't support this option.
|
508
|
-
|
509
|
-
### See also
|
510
|
-
|
511
|
-
* [Markdown Syntax Documentation](http://daringfireball.net/projects/markdown/syntax/)
|
512
|
-
|
513
|
-
<a name='rdiscount'></a>
|
514
|
-
RDiscount (`markdown`, `md`, `mkd`)
|
515
|
-
-----------------------------------
|
516
|
-
|
517
|
-
[Discount][discount] is an implementation of the Markdown markup language in C.
|
518
|
-
[RDiscount][rdiscount] is a Ruby wrapper around Discount.
|
519
|
-
|
520
|
-
All the documentation of [Markdown](#markdown) applies in addition to the following:
|
521
|
-
|
522
|
-
### Usage
|
523
|
-
|
524
|
-
The `Tilt::RDiscountTemplate` class is registered for all files ending in
|
525
|
-
`.markdown`, `.md` or `.mkd` by default with the highest priority. If you
|
526
|
-
specifically want to use RDiscount, it's recommended to use `#prefer`:
|
527
|
-
|
528
|
-
Tilt.prefer Tilt::RDiscountTemplate
|
529
|
-
|
530
|
-
__NOTE:__ It's suggested that your program `require 'erubis'` at load time when
|
531
|
-
using this template engine within a threaded environment.
|
532
|
-
|
533
|
-
### See also
|
534
|
-
|
535
|
-
* [Discount][discount]
|
536
|
-
* [RDiscount][rdiscount]
|
537
|
-
* GitHub: [rtomayko/rdiscount][rdiscount]
|
538
|
-
|
539
|
-
|
540
|
-
[lesscss]: http://lesscss.org/ "Less CSS"
|
541
|
-
[sass]: http://sass-lang.com/ "Sass"
|
542
|
-
[coffee-script]: http://jashkenas.github.com/coffee-script/ "Coffee Script"
|
543
|
-
[erubis]: http://www.kuwata-lab.com/erubis/ "Erubis"
|
544
|
-
[haml]: http://haml.info/ "Haml"
|
545
|
-
[liquid]: http://www.liquidmarkup.org/ "Liquid"
|
546
|
-
[radius]: http://radius.rubyforge.org/ "Radius"
|
547
|
-
[radiant]: http://radiantcms.org/ "Radiant CMS"
|
548
|
-
[redcloth]: http://redcloth.org/ "RedCloth"
|
549
|
-
[rdoc]: http://rdoc.rubyforge.org/ "RDoc"
|
550
|
-
[discount]: http://www.pell.portland.or.us/~orc/Code/discount/ "Discount"
|
551
|
-
[rdiscount]: http://github.com/rtomayko/rdiscount/ "RDiscount"
|
552
|
-
[smartypants]: http://daringfireball.net/projects/smartypants/ "Smarty Pants"
|
553
|
-
[markdown]: http://en.wikipedia.org/wiki/Markdown "Markdown"
|
554
|
-
[pandoc]: http://pandoc.org/ "Pandoc"
|
555
|
-
[pandoc-ruby]: https://github.com/alphabetum/pandoc-ruby "pandoc-ruby"
|
data/docs/common.css
DELETED
data/man/index.txt
DELETED
data/man/tilt.1.ronn
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
tilt(1) -- process templates
|
2
|
-
============================
|
3
|
-
|
4
|
-
## SYNOPSIS
|
5
|
-
|
6
|
-
`tilt` `-l`<br>
|
7
|
-
`tilt` [`-t` <pattern>] [`-y` <file>] [`-D` <name>=<value>] [`-d` <file>]
|
8
|
-
[`--vars=`<ruby>] <file>
|
9
|
-
|
10
|
-
## DESCRIPTION
|
11
|
-
|
12
|
-
Process template <file> and write output to stdout. With no <file> or
|
13
|
-
when <file> is '-', read template from stdin and use the --type option
|
14
|
-
to determine the template's type.
|
15
|
-
|
16
|
-
## OPTIONS
|
17
|
-
|
18
|
-
* `-l`, `--list`:
|
19
|
-
List template engines + file patterns and exit
|
20
|
-
* `-t`, `--type`=<pattern>:
|
21
|
-
Use this template engine; required if no <file>
|
22
|
-
* `-y`, `--layout`=<file>:
|
23
|
-
Use <file> as a layout template
|
24
|
-
* `-D`<name>=<value>:
|
25
|
-
Define variable <name> as <value>
|
26
|
-
* `-d`, `--define-file`=<file>:
|
27
|
-
Load YAML or JSON from <file> and use for variables
|
28
|
-
* `--vars`=<ruby>:
|
29
|
-
Evaluate <ruby> to Hash and use for variables
|
30
|
-
* `-h`, `--help`:
|
31
|
-
Show this help message
|
32
|
-
|
33
|
-
## EXAMPLES
|
34
|
-
|
35
|
-
Convert markdown to HTML:
|
36
|
-
|
37
|
-
$ tilt foo.markdown > foo.html
|
38
|
-
|
39
|
-
Process ERB template:
|
40
|
-
|
41
|
-
$ echo "Answer: <%= 2 + 2 %>" | tilt -t erb
|
42
|
-
Answer: 4
|
43
|
-
|
44
|
-
Define variables:
|
45
|
-
|
46
|
-
$ echo '{"n":40}' > data.json
|
47
|
-
$ echo "Answer: <%= 2 + n %>" | tilt -t erb -d data.json
|
48
|
-
Answer: 42
|
49
|
-
|
50
|
-
$ echo "Answer: <%= 2 + n %>" | tilt -t erb --vars="{:n=>40}"
|
51
|
-
Answer: 42
|
52
|
-
$ echo "Answer: <%= 2 + n.to_i %>" | tilt -t erb -Dn=40
|
53
|
-
Answer: 42
|
54
|
-
|
55
|
-
## SEE ALSO
|
56
|
-
|
57
|
-
m4(1), mustache(1)
|
58
|
-
|
59
|
-
|
data/test/markaby/locals.mab
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
li foo
|
data/test/markaby/markaby.mab
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
text "hello from markaby!"
|
@@ -1 +0,0 @@
|
|
1
|
-
text "_why?"
|
@@ -1 +0,0 @@
|
|
1
|
-
text "foo"
|
data/test/markaby/scope.mab
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
li foo
|
data/test/markaby/yielding.mab
DELETED
data/test/mytemplate.rb
DELETED