module Tilt
Namespace for Tilt
. This module is not intended to be included anywhere.
Constants
- AsciidoctorTemplate
Asciidoctor implementation for AsciiDoc see: asciidoctor.github.com/
Asciidoctor is an open source, pure-Ruby processor for converting AsciiDoc documents or strings into HTML 5, DocBook 4.5 and other formats.
- BabelTemplate
- CommonMarkerTemplate
- CreoleTemplate
Creole implementation. See: www.wikicreole.org/
- EMPTY_HASH
- HamlTemplate
Haml >= 6 ships its own template, prefer it when available.
- KramdownTemplate
Kramdown Markdown implementation. See: kramdown.gettalong.org/
- LOCK
@private
- LiveScriptTemplate
LiveScript template implementation. See: livescript.net/
LiveScript templates do not support object scopes, locals, or yield.
- MarukuTemplate
Maruku markdown implementation. See: github.com/bhollis/maruku
- PandocTemplate
Pandoc markdown implementation. See: pandoc.org/
- PlainTemplate
Raw text (no template functionality).
- RDiscountTemplate
Discount Markdown implementation. See: github.com/rtomayko/rdiscount
RDiscount is a simple text filter. It does not support
scope
orlocals
. The:smart
and:filter_html
options may be set true to enable those flags on the underlying RDiscount object.- RDocTemplate
RDoc template. See: github.com/ruby/rdoc
It's suggested that your program run the following at load time when using this templae engine in a threaded environment:
require 'rdoc' require 'rdoc/markup' require 'rdoc/markup/to_html' require 'rdoc/options'
- RedClothTemplate
RedCloth implementation. See: github.com/jgarber/redcloth
- RedcarpetTemplate
- RstPandocTemplate
Pandoc reStructuredText implementation. See: # pandoc.org/
- SlimTemplate
- TOPOBJECT
@private
- TypeScriptTemplate
- VERSION
Current version.
- WikiClothTemplate
WikiCloth implementation. See: github.com/nricciar/wikicloth
Attributes
@return [Tilt::Mapping] the main mapping object
Public Class Methods
@see Tilt::Mapping#[]
# File lib/tilt.rb 69 def self.[](file) 70 @default_mapping[file] 71 end
@return the template object that is currently rendering.
@example
tmpl = Tilt['index.erb'].new { '<%= Tilt.current_template %>' } tmpl.render == tmpl.to_s
@note This is currently an experimental feature and might return nil
in the future.
# File lib/tilt.rb 91 def self.current_template 92 warn "Tilt.current_template is deprecated and will be removed in Tilt 2.3", uplevel: 1 93 Thread.current[:tilt_current_template] 94 end
Replace the default mapping with a finalized version of the default mapping. This can be done to improve performance after the template libraries you desire to use have already been loaded. Once this is is called, all attempts to modify the default mapping will fail. This also freezes Tilt
itself.
# File lib/tilt.rb 20 def self.finalize! 21 class << self 22 prepend(Module.new do 23 def lazy_map(*) 24 raise "Tilt.#{__callee__} not supported after Tilt.finalize! has been called" 25 end 26 alias register lazy_map 27 alias register_lazy lazy_map 28 alias register_pipeline lazy_map 29 alias prefer lazy_map 30 end) 31 end 32 33 @default_mapping = @default_mapping.finalized 34 35 freeze 36 end
# File lib/tilt.rb 23 def lazy_map(*) 24 raise "Tilt.#{__callee__} not supported after Tilt.finalize! has been called" 25 end
@see Tilt::Mapping#new
# File lib/tilt.rb 64 def self.new(file, line=nil, options=nil, &block) 65 @default_mapping.new(file, line, options, &block) 66 end
@see Tilt::Mapping#registered?
# File lib/tilt.rb 59 def self.registered?(ext) 60 @default_mapping.registered?(ext) 61 end
@see Tilt::Mapping#template_for
# File lib/tilt.rb 74 def self.template_for(file) 75 @default_mapping.template_for(file) 76 end
@see Tilt::Mapping#templates_for
# File lib/tilt.rb 79 def self.templates_for(file) 80 @default_mapping.templates_for(file) 81 end