Module Sinatra::Templates
In: lib/sinatra/base.rb

Template rendering methods. Each method takes the name of a template to render as a Symbol and returns a String with the rendered output, as well as an optional hash with additional options.

`template` is either the name or path of the template as symbol (Use `:’subdir/myview’` for views in subdirectories), or a string that will be rendered.

Possible options are:

  :layout       If set to false, no layout is rendered, otherwise
                the specified layout is used (Ignored for `sass` and `less`)
  :locals       A hash with local variables that should be available
                in the template

Methods

builder   coffee   erb   erubis   haml   less   liquid   markaby   markdown   nokogiri   radius   rdoc   sass   scss   textile  

Included Modules

Tilt::CompileSite

Classes and Modules

Module Sinatra::Templates::ContentTyped

Public Instance methods

[Source]

     # File lib/sinatra/base.rb, line 388
388:     def builder(template=nil, options={}, locals={}, &block)
389:       render_xml(:builder, template, options, locals, &block)
390:     end

[Source]

     # File lib/sinatra/base.rb, line 416
416:     def coffee(template, options={}, locals={})
417:       options.merge! :layout => false, :default_content_type => :js
418:       render :coffee, template, options, locals
419:     end

[Source]

     # File lib/sinatra/base.rb, line 361
361:     def erb(template, options={}, locals={})
362:       render :erb, template, options, locals
363:     end

[Source]

     # File lib/sinatra/base.rb, line 365
365:     def erubis(template, options={}, locals={})
366:       render :erubis, template, options, locals
367:     end

[Source]

     # File lib/sinatra/base.rb, line 369
369:     def haml(template, options={}, locals={})
370:       render :haml, template, options, locals
371:     end

[Source]

     # File lib/sinatra/base.rb, line 383
383:     def less(template, options={}, locals={})
384:       options.merge! :layout => false, :default_content_type => :css
385:       render :less, template, options, locals
386:     end

[Source]

     # File lib/sinatra/base.rb, line 392
392:     def liquid(template, options={}, locals={})
393:       render :liquid, template, options, locals
394:     end

[Source]

     # File lib/sinatra/base.rb, line 412
412:     def markaby(template, options={}, locals={})
413:       render :mab, template, options, locals
414:     end

[Source]

     # File lib/sinatra/base.rb, line 396
396:     def markdown(template, options={}, locals={})
397:       render :markdown, template, options, locals
398:     end

[Source]

     # File lib/sinatra/base.rb, line 421
421:     def nokogiri(template=nil, options={}, locals={}, &block)
422:       options[:layout] = false if Tilt::VERSION <= "1.1"
423:       render_xml(:nokogiri, template, options, locals, &block)
424:     end

[Source]

     # File lib/sinatra/base.rb, line 408
408:     def radius(template, options={}, locals={})
409:       render :radius, template, options, locals
410:     end

[Source]

     # File lib/sinatra/base.rb, line 404
404:     def rdoc(template, options={}, locals={})
405:       render :rdoc, template, options, locals
406:     end

[Source]

     # File lib/sinatra/base.rb, line 373
373:     def sass(template, options={}, locals={})
374:       options.merge! :layout => false, :default_content_type => :css
375:       render :sass, template, options, locals
376:     end

[Source]

     # File lib/sinatra/base.rb, line 378
378:     def scss(template, options={}, locals={})
379:       options.merge! :layout => false, :default_content_type => :css
380:       render :scss, template, options, locals
381:     end

[Source]

     # File lib/sinatra/base.rb, line 400
400:     def textile(template, options={}, locals={})
401:       render :textile, template, options, locals
402:     end

[Validate]