Module: Tilt

Defined in:
lib/tilt.rb,
lib/tilt/csv.rb,
lib/tilt/erb.rb,
lib/tilt/haml.rb,
lib/tilt/less.rb,
lib/tilt/rdoc.rb,
lib/tilt/sass.rb,
lib/tilt/yajl.rb,
lib/tilt/babel.rb,
lib/tilt/erubi.rb,
lib/tilt/plain.rb,
lib/tilt/prawn.rb,
lib/tilt/sigil.rb,
lib/tilt/coffee.rb,
lib/tilt/creole.rb,
lib/tilt/erubis.rb,
lib/tilt/etanni.rb,
lib/tilt/liquid.rb,
lib/tilt/maruku.rb,
lib/tilt/pandoc.rb,
lib/tilt/radius.rb,
lib/tilt/string.rb,
lib/tilt/builder.rb,
lib/tilt/mapping.rb,
lib/tilt/markaby.rb,
lib/tilt/asciidoc.rb,
lib/tilt/kramdown.rb,
lib/tilt/nokogiri.rb,
lib/tilt/redcloth.rb,
lib/tilt/template.rb,
lib/tilt/bluecloth.rb,
lib/tilt/rdiscount.rb,
lib/tilt/redcarpet.rb,
lib/tilt/wikicloth.rb,
lib/tilt/livescript.rb,
lib/tilt/rst-pandoc.rb,
lib/tilt/typescript.rb,
lib/tilt/commonmarker.rb

Overview

AsciiDoc see: asciidoc.org/

Defined Under Namespace

Classes: AsciidoctorTemplate, BabelTemplate, BlueClothTemplate, BuilderTemplate, CSVTemplate, Cache, CoffeeScriptLiterateTemplate, CoffeeScriptTemplate, CommonMarkerTemplate, CreoleTemplate, Dummy, ERBTemplate, ErubiTemplate, ErubisTemplate, EtanniTemplate, HamlTemplate, KramdownTemplate, LessTemplate, LiquidTemplate, LiveScriptTemplate, Mapping, MarkabyTemplate, MarukuTemplate, NokogiriTemplate, PandocTemplate, PlainTemplate, PrawnTemplate, RDiscountTemplate, RDocTemplate, RadiusTemplate, RedClothTemplate, Redcarpet1Template, Redcarpet2Template, RstPandocTemplate, SassTemplate, ScssTemplate, SigilTemplate, StringTemplate, Template, TypeScriptTemplate, WikiClothTemplate, YajlTemplate

Constant Summary collapse

VERSION =

Current version.

'2.0.9'
TOPOBJECT =
if RUBY_VERSION >= '2.0'
  # @private
  module CompiledTemplates
    self
  end
elsif RUBY_VERSION >= '1.9'
  BasicObject
else
  Object
end
LOCK =
Mutex.new
RedcarpetTemplate =
Redcarpet1Template

Class Method Summary collapse

Class Method Details

.[](file) ⇒ Object

See Also:


47
48
49
# File 'lib/tilt.rb', line 47

def self.[](file)
  default_mapping[file]
end

.current_templateObject

Note:

This is currently an experimental feature and might return nil in the future.

Returns the template object that is currently rendering.

Examples:

tmpl = Tilt['index.erb'].new { '<%= Tilt.current_template %>' }
tmpl.render == tmpl.to_s

69
70
71
# File 'lib/tilt.rb', line 69

def self.current_template
  Thread.current[:tilt_current_template]
end

.default_mappingTilt::Mapping


12
13
14
# File 'lib/tilt.rb', line 12

def self.default_mapping
  @default_mapping
end

.lazy_mapObject


17
18
19
# File 'lib/tilt.rb', line 17

def self.lazy_map
  default_mapping.lazy_map
end

.new(file, line = nil, options = {}, &block) ⇒ Object

See Also:


42
43
44
# File 'lib/tilt.rb', line 42

def self.new(file, line=nil, options={}, &block)
  default_mapping.new(file, line, options, &block)
end

.prefer(template_class, *extensions) ⇒ Object

Deprecated.

Use register instead.


32
33
34
# File 'lib/tilt.rb', line 32

def self.prefer(template_class, *extensions)
  register(template_class, *extensions)
end

.register(template_class, *extensions) ⇒ Object


22
23
24
# File 'lib/tilt.rb', line 22

def self.register(template_class, *extensions)
  default_mapping.register(template_class, *extensions)
end

.register_lazy(class_name, file, *extensions) ⇒ Object


27
28
29
# File 'lib/tilt.rb', line 27

def self.register_lazy(class_name, file, *extensions)
  default_mapping.register_lazy(class_name, file, *extensions)
end

.registered?(ext) ⇒ Boolean


37
38
39
# File 'lib/tilt.rb', line 37

def self.registered?(ext)
  default_mapping.registered?(ext)
end

.template_for(file) ⇒ Object


52
53
54
# File 'lib/tilt.rb', line 52

def self.template_for(file)
  default_mapping.template_for(file)
end

.templates_for(file) ⇒ Object


57
58
59
# File 'lib/tilt.rb', line 57

def self.templates_for(file)
  default_mapping.templates_for(file)
end