tilt 2.0.9 → 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tilt.rb +1 -1
  3. data/lib/tilt/template.rb +7 -12
  4. metadata +3 -104
  5. data/CHANGELOG.md +0 -132
  6. data/Gemfile +0 -70
  7. data/HACKING +0 -16
  8. data/README.md +0 -233
  9. data/Rakefile +0 -106
  10. data/docs/TEMPLATES.md +0 -555
  11. data/docs/common.css +0 -14
  12. data/man/index.txt +0 -2
  13. data/man/tilt.1.ronn +0 -59
  14. data/test/markaby/locals.mab +0 -1
  15. data/test/markaby/markaby.mab +0 -1
  16. data/test/markaby/markaby_other_static.mab +0 -1
  17. data/test/markaby/render_twice.mab +0 -1
  18. data/test/markaby/scope.mab +0 -1
  19. data/test/markaby/yielding.mab +0 -2
  20. data/test/mytemplate.rb +0 -2
  21. data/test/test_helper.rb +0 -64
  22. data/test/tilt_asciidoctor_test.rb +0 -50
  23. data/test/tilt_babeltemplate.rb +0 -33
  24. data/test/tilt_blueclothtemplate_test.rb +0 -33
  25. data/test/tilt_buildertemplate_test.rb +0 -72
  26. data/test/tilt_cache_test.rb +0 -43
  27. data/test/tilt_coffeescripttemplate_test.rb +0 -141
  28. data/test/tilt_commonmarkertemplate_test.rb +0 -28
  29. data/test/tilt_compilesite_test.rb +0 -51
  30. data/test/tilt_creoletemplate_test.rb +0 -24
  31. data/test/tilt_csv_test.rb +0 -77
  32. data/test/tilt_erbtemplate_test.rb +0 -239
  33. data/test/tilt_erubistemplate_test.rb +0 -151
  34. data/test/tilt_erubitemplate_test.rb +0 -158
  35. data/test/tilt_etannitemplate_test.rb +0 -174
  36. data/test/tilt_hamltemplate_test.rb +0 -166
  37. data/test/tilt_kramdown_test.rb +0 -20
  38. data/test/tilt_lesstemplate_test.less +0 -1
  39. data/test/tilt_lesstemplate_test.rb +0 -42
  40. data/test/tilt_liquidtemplate_test.rb +0 -87
  41. data/test/tilt_livescripttemplate_test.rb +0 -37
  42. data/test/tilt_mapping_test.rb +0 -232
  43. data/test/tilt_markaby_test.rb +0 -88
  44. data/test/tilt_markdown_test.rb +0 -186
  45. data/test/tilt_marukutemplate_test.rb +0 -36
  46. data/test/tilt_metadata_test.rb +0 -42
  47. data/test/tilt_nokogiritemplate_test.rb +0 -87
  48. data/test/tilt_pandoctemplate_test.rb +0 -67
  49. data/test/tilt_prawntemplate.prawn +0 -1
  50. data/test/tilt_prawntemplate_test.rb +0 -75
  51. data/test/tilt_radiustemplate_test.rb +0 -75
  52. data/test/tilt_rdiscounttemplate_test.rb +0 -43
  53. data/test/tilt_rdoctemplate_test.rb +0 -29
  54. data/test/tilt_redcarpettemplate_test.rb +0 -54
  55. data/test/tilt_redclothtemplate_test.rb +0 -36
  56. data/test/tilt_rstpandoctemplate_test.rb +0 -32
  57. data/test/tilt_sasstemplate_test.rb +0 -42
  58. data/test/tilt_sigil_test.rb +0 -41
  59. data/test/tilt_stringtemplate_test.rb +0 -171
  60. data/test/tilt_template_test.rb +0 -314
  61. data/test/tilt_test.rb +0 -60
  62. data/test/tilt_typescript_test.rb +0 -38
  63. data/test/tilt_wikiclothtemplate_test.rb +0 -32
  64. data/test/tilt_yajltemplate_test.rb +0 -101
  65. data/tilt.gemspec +0 -130
data/Rakefile DELETED
@@ -1,106 +0,0 @@
1
- require 'bundler'
2
- Bundler.setup
3
-
4
- require 'rake/testtask'
5
- task :default => [:test]
6
-
7
- # SPECS =====================================================================
8
-
9
- desc 'Run tests (default)'
10
- Rake::TestTask.new(:test) do |t|
11
- t.test_files = FileList['test/*_test.rb']
12
- t.ruby_opts = ['-Itest']
13
- t.ruby_opts << '-rrubygems' if defined? Gem
14
- t.warning = false
15
- end
16
-
17
- # DOCUMENTATION =============================================================
18
-
19
- begin
20
- require 'yard'
21
- YARD::Rake::YardocTask.new do |t|
22
- t.files = [
23
- 'lib/tilt.rb', 'lib/tilt/mapping.rb', 'lib/tilt/template.rb',
24
- '-',
25
- '*.md', 'docs/*.md',
26
- ]
27
-
28
- t.options <<
29
- '--no-private' <<
30
- '--protected' <<
31
- '-m' << 'markdown' <<
32
- '--asset' << 'docs/common.css:css/common.css'
33
- end
34
- rescue LoadError
35
- end
36
-
37
- task :man do
38
- require 'ronn'
39
- ENV['RONN_MANUAL'] = "Tilt Manual"
40
- ENV['RONN_ORGANIZATION'] = "Tilt #{SPEC.version}"
41
- sh "ronn -w -s toc -r5 --markdown man/*.ronn"
42
- end
43
-
44
- # PACKAGING =================================================================
45
-
46
- begin
47
- require 'rubygems'
48
- rescue LoadError
49
- end
50
-
51
- if defined?(Gem)
52
- SPEC = eval(File.read('tilt.gemspec'))
53
-
54
- def package(ext='')
55
- "pkg/tilt-#{SPEC.version}" + ext
56
- end
57
-
58
- desc 'Build packages'
59
- task :package => %w[.gem .tar.gz].map {|e| package(e)}
60
-
61
- desc 'Build and install as local gem'
62
- task :install => package('.gem') do
63
- sh "gem install #{package('.gem')}"
64
- end
65
-
66
- directory 'pkg/'
67
-
68
- file package('.gem') => %w[pkg/ tilt.gemspec] + SPEC.files do |f|
69
- sh "gem build tilt.gemspec"
70
- mv File.basename(f.name), f.name
71
- end
72
-
73
- file package('.tar.gz') => %w[pkg/] + SPEC.files do |f|
74
- sh "git archive --format=tar HEAD | gzip > #{f.name}"
75
- end
76
-
77
- desc 'Upload gem and tar.gz distributables to rubyforge'
78
- task :release => [package('.gem'), package('.tar.gz')] do |t|
79
- sh <<-SH
80
- rubyforge add_release sinatra tilt #{SPEC.version} #{package('.gem')} &&
81
- rubyforge add_file sinatra tilt #{SPEC.version} #{package('.tar.gz')}
82
- SH
83
- end
84
- end
85
-
86
- # GEMSPEC ===================================================================
87
-
88
- file 'tilt.gemspec' => FileList['{lib,test}/**','Rakefile'] do |f|
89
- # read version from tilt.rb
90
- version = File.read('lib/tilt.rb')[/VERSION = '(.*)'/] && $1
91
- # read spec file and split out manifest section
92
- spec = File.
93
- read(f.name).
94
- sub(/s\.version\s*=\s*'.*'/, "s.version = '#{version}'")
95
- parts = spec.split(" # = MANIFEST =\n")
96
- # determine file list from git ls-files
97
- files = `git ls-files`.
98
- split("\n").sort.reject{ |file| file =~ /^\./ }.
99
- map{ |file| " #{file}" }.join("\n")
100
- # piece file back together and write...
101
- parts[1] = " s.files = %w[\n#{files}\n ]\n"
102
- spec = parts.join(" # = MANIFEST =\n")
103
- spec.sub!(/s.date = '.*'/, "s.date = '#{Time.now.strftime("%Y-%m-%d")}'")
104
- File.open(f.name, 'w') { |io| io.write(spec) }
105
- puts "updated #{f.name}"
106
- end
@@ -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"