Class: HamlCoffeeAssets::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/haml_coffee_assets/configuration.rb

Overview

Haml Coffee configuration object that contains the default values. It’s a plain Ruby object so a Sinatra app doesn’t have to depend on ActiveSupport just because of the Rails engine configuration.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Constructor with defaults



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/haml_coffee_assets/configuration.rb', line 11

def initialize
  self.namespace              = 'window.JST'
  self.format                 = 'html5'
  self.uglify                 = false
  self.basename               = false
  self.escapeHtml             = true
  self.escapeAttributes       = true
  self.cleanValue             = true
  self.customHtmlEscape       = 'window.HAML.escape'
  self.customCleanValue       = 'window.HAML.cleanValue'
  self.customPreserve         = 'window.HAML.preserve'
  self.customFindAndPreserve  = 'window.HAML.findAndPreserve'
  self.customSurround         = 'window.HAML.surround'
  self.customSucceed          = 'window.HAML.succeed'
  self.customPrecede          = 'window.HAML.precede'
  self.preserveTags           = 'textarea,pre'
  self.selfCloseTags          = 'meta,img,link,br,hr,input,area,param,col,base'
  self.context                = 'window.HAML.context'
  self.extendScope            = false
  self.name_filter            = lambda { |n| n.sub /^templates\//, '' }
end

Instance Attribute Details

#basenameObject

Ignore path when generate the JST



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

def basename
  @basename
end

#cleanValueObject

Clean inline CoffeeScript values



59
60
61
# File 'lib/haml_coffee_assets/configuration.rb', line 59

def cleanValue
  @cleanValue
end

#contextObject

Custom global context to merge



99
100
101
# File 'lib/haml_coffee_assets/configuration.rb', line 99

def context
  @context
end

#customCleanValueObject

Custom global code clean value function



67
68
69
# File 'lib/haml_coffee_assets/configuration.rb', line 67

def customCleanValue
  @customCleanValue
end

#customFindAndPreserveObject

Custom find and preserve function



87
88
89
# File 'lib/haml_coffee_assets/configuration.rb', line 87

def customFindAndPreserve
  @customFindAndPreserve
end

#customHtmlEscapeObject

Custom global HTML escaping function



63
64
65
# File 'lib/haml_coffee_assets/configuration.rb', line 63

def customHtmlEscape
  @customHtmlEscape
end

#customPrecedeObject

Custom global precede function



79
80
81
# File 'lib/haml_coffee_assets/configuration.rb', line 79

def customPrecede
  @customPrecede
end

#customPreserveObject

Custom preserve function



83
84
85
# File 'lib/haml_coffee_assets/configuration.rb', line 83

def customPreserve
  @customPreserve
end

#customSucceedObject

Custom global succeed function



75
76
77
# File 'lib/haml_coffee_assets/configuration.rb', line 75

def customSucceed
  @customSucceed
end

#customSurroundObject

Custom global surround function



71
72
73
# File 'lib/haml_coffee_assets/configuration.rb', line 71

def customSurround
  @customSurround
end

#escapeAttributesObject

Escape template code output for attributes



55
56
57
# File 'lib/haml_coffee_assets/configuration.rb', line 55

def escapeAttributes
  @escapeAttributes
end

#escapeHtmlObject

Escape template code output



51
52
53
# File 'lib/haml_coffee_assets/configuration.rb', line 51

def escapeHtml
  @escapeHtml
end

#extendScopeObject

Extend the template scope with the context



103
104
105
# File 'lib/haml_coffee_assets/configuration.rb', line 103

def extendScope
  @extendScope
end

#formatObject

Template format, either html5, html4 or xhtml



39
40
41
# File 'lib/haml_coffee_assets/configuration.rb', line 39

def format
  @format
end

#name_filterObject

A proc that is called to modify the template name used as the JST key. The proc is passed the name as an argument and should return the modified name (or unmodified) name.



109
110
111
# File 'lib/haml_coffee_assets/configuration.rb', line 109

def name_filter
  @name_filter
end

#namespaceObject

Template namespace



35
36
37
# File 'lib/haml_coffee_assets/configuration.rb', line 35

def namespace
  @namespace
end

#preserveTagsObject

List of tags to preserve



91
92
93
# File 'lib/haml_coffee_assets/configuration.rb', line 91

def preserveTags
  @preserveTags
end

#selfCloseTagsObject

List of self closing tags



95
96
97
# File 'lib/haml_coffee_assets/configuration.rb', line 95

def selfCloseTags
  @selfCloseTags
end

#uglifyObject

Uglify HTML output by skip indention



43
44
45
# File 'lib/haml_coffee_assets/configuration.rb', line 43

def uglify
  @uglify
end