haml 5.0.0 → 5.0.1
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.
- checksums.yaml +4 -4
- data/.gitignore +18 -0
- data/.gitmodules +3 -0
- data/.travis.yml +38 -0
- data/CHANGELOG.md +43 -19
- data/Gemfile +18 -0
- data/README.md +1 -0
- data/Rakefile +6 -12
- data/TODO +24 -0
- data/benchmark.rb +66 -0
- data/haml.gemspec +39 -0
- data/lib/haml/.gitattributes +1 -0
- data/lib/haml/attribute_parser.rb +4 -0
- data/lib/haml/compiler.rb +2 -1
- data/lib/haml/helpers/safe_erubi_template.rb +0 -8
- data/lib/haml/options.rb +3 -0
- data/lib/haml/railtie.rb +11 -2
- data/lib/haml/temple_engine.rb +1 -0
- data/lib/haml/version.rb +1 -1
- data/test/attribute_parser_test.rb +4 -0
- data/test/engine_test.rb +7 -0
- data/test/filters_test.rb +2 -7
- data/test/template_test.rb +10 -0
- data/yard/default/.gitignore +1 -0
- data/yard/default/fulldoc/html/css/common.sass +15 -0
- data/yard/default/layout/html/footer.erb +12 -0
- metadata +13 -65
- data/test/erb/_av_partial_1.erb +0 -12
- data/test/erb/_av_partial_2.erb +0 -8
- data/test/erb/action_view.erb +0 -62
- data/test/erb/standard.erb +0 -55
- data/test/gemfiles/Gemfile.rails-4.0.x +0 -11
- data/test/gemfiles/Gemfile.rails-4.0.x.lock +0 -87
- data/test/gemfiles/Gemfile.rails-4.1.x +0 -5
- data/test/gemfiles/Gemfile.rails-4.2.x +0 -5
- data/test/gemfiles/Gemfile.rails-5.0.x +0 -4
- data/test/markaby/standard.mab +0 -52
- data/test/mocks/article.rb +0 -6
- data/test/results/bemit.xhtml +0 -4
- data/test/results/content_for_layout.xhtml +0 -12
- data/test/results/eval_suppressed.xhtml +0 -9
- data/test/results/helpers.xhtml +0 -72
- data/test/results/helpful.xhtml +0 -13
- data/test/results/just_stuff.xhtml +0 -71
- data/test/results/list.xhtml +0 -12
- data/test/results/nuke_inner_whitespace.xhtml +0 -40
- data/test/results/nuke_outer_whitespace.xhtml +0 -140
- data/test/results/original_engine.xhtml +0 -20
- data/test/results/partial_layout.xhtml +0 -6
- data/test/results/partial_layout_erb.xhtml +0 -6
- data/test/results/partials.xhtml +0 -22
- data/test/results/render_layout.xhtml +0 -3
- data/test/results/silent_script.xhtml +0 -74
- data/test/results/standard.xhtml +0 -159
- data/test/results/tag_parsing.xhtml +0 -23
- data/test/results/very_basic.xhtml +0 -5
- data/test/results/whitespace_handling.xhtml +0 -91
- data/test/template_test_helper.rb +0 -38
- data/test/templates/_av_partial_1.haml +0 -9
- data/test/templates/_av_partial_2.haml +0 -5
- data/test/templates/_layout.erb +0 -3
- data/test/templates/_layout_for_partial.haml +0 -3
- data/test/templates/_partial.haml +0 -8
- data/test/templates/_text_area.haml +0 -3
- data/test/templates/_text_area_helper.html.haml +0 -4
- data/test/templates/action_view.haml +0 -47
- data/test/templates/bemit.haml +0 -3
- data/test/templates/breakage.haml +0 -8
- data/test/templates/content_for_layout.haml +0 -8
- data/test/templates/eval_suppressed.haml +0 -11
- data/test/templates/helpers.haml +0 -55
- data/test/templates/helpful.haml +0 -11
- data/test/templates/just_stuff.haml +0 -86
- data/test/templates/list.haml +0 -12
- data/test/templates/nuke_inner_whitespace.haml +0 -32
- data/test/templates/nuke_outer_whitespace.haml +0 -144
- data/test/templates/original_engine.haml +0 -17
- data/test/templates/partial_layout.haml +0 -3
- data/test/templates/partial_layout_erb.erb +0 -4
- data/test/templates/partialize.haml +0 -1
- data/test/templates/partials.haml +0 -12
- data/test/templates/render_layout.haml +0 -2
- data/test/templates/silent_script.haml +0 -45
- data/test/templates/standard.haml +0 -43
- data/test/templates/standard_ugly.haml +0 -1
- data/test/templates/tag_parsing.haml +0 -21
- data/test/templates/very_basic.haml +0 -4
- data/test/templates/whitespace_handling.haml +0 -87
- data/test/templates/with_bom.haml +0 -1
- data/test/test_helper.rb +0 -99
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f839cdb94174ba8781070c63c81802476e784313
|
4
|
+
data.tar.gz: 95438da1cb7cd8137a2d5d6a838c126530165797
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bf0fb1e2b30d0c6b0fb02bc26ce4e994a3a806fcc2a3e46f8ef4b4ef850642b3e85cbfe5660b174bddd44d04e72facceefb2c2229eb57abc5ca32bd8305790d
|
7
|
+
data.tar.gz: 23439f7250b7c914333b0702a9eade9c96a7bbf123e5df44c6099c826263bd69e3986ab5343f2c8cf7bc1a68644283a4a46685c8cbd750680ee4ec9b01b4ec62
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
sudo: false
|
2
|
+
dist: trusty
|
3
|
+
language: ruby
|
4
|
+
cache: bundler
|
5
|
+
rvm:
|
6
|
+
- 2.4.1
|
7
|
+
- 2.3.4
|
8
|
+
- 2.2.7
|
9
|
+
- 2.1.10
|
10
|
+
- 2.0.0
|
11
|
+
- jruby-9.1.8.0
|
12
|
+
- rbx-3
|
13
|
+
gemfile:
|
14
|
+
- test/gemfiles/Gemfile.rails-4.0.x
|
15
|
+
- test/gemfiles/Gemfile.rails-4.1.x
|
16
|
+
- test/gemfiles/Gemfile.rails-4.2.x
|
17
|
+
- test/gemfiles/Gemfile.rails-5.0.x
|
18
|
+
- test/gemfiles/Gemfile.rails-5.1.x
|
19
|
+
matrix:
|
20
|
+
exclude:
|
21
|
+
- rvm: 2.0.0
|
22
|
+
gemfile: test/gemfiles/Gemfile.rails-5.1.x
|
23
|
+
- rvm: 2.1.10
|
24
|
+
gemfile: test/gemfiles/Gemfile.rails-5.1.x
|
25
|
+
- rvm: 2.0.0
|
26
|
+
gemfile: test/gemfiles/Gemfile.rails-5.0.x
|
27
|
+
- rvm: 2.1.10
|
28
|
+
gemfile: test/gemfiles/Gemfile.rails-5.0.x
|
29
|
+
- rvm: 2.4.1
|
30
|
+
gemfile: test/gemfiles/Gemfile.rails-4.0.x
|
31
|
+
- rvm: 2.4.1
|
32
|
+
gemfile: test/gemfiles/Gemfile.rails-4.1.x
|
33
|
+
- rvm: 2.4.1
|
34
|
+
gemfile: test/gemfiles/Gemfile.rails-4.2.x
|
35
|
+
allow_failures:
|
36
|
+
- rvm: rbx-3
|
37
|
+
fast_finish: true
|
38
|
+
script: "bundle exec rake submodules test"
|
data/CHANGELOG.md
CHANGED
@@ -1,43 +1,67 @@
|
|
1
1
|
# Haml Changelog
|
2
2
|
|
3
|
+
## 5.0.1
|
4
|
+
|
5
|
+
Released on May 3, 2017
|
6
|
+
([diff](https://github.com/haml/haml/compare/v5.0.0...v5.0.1)).
|
7
|
+
|
8
|
+
* Fix parsing attributes including string interpolation. [#917](https://github.com/haml/haml/pull/917) [#921](https://github.com/haml/haml/issues/921)
|
9
|
+
* Stop distributing test files in gem package and allow installing on Windows.
|
10
|
+
* Use ActionView's Erubi/Erubis handler for erb filter only on ActionView. [#914](https://github.com/haml/haml/pull/914)
|
11
|
+
|
3
12
|
## 5.0.0
|
4
13
|
|
5
14
|
Released on April 26, 2017
|
6
|
-
([diff](https://github.com/haml/haml/compare/4.0.7...
|
15
|
+
([diff](https://github.com/haml/haml/compare/4.0.7...v5.0.0)).
|
16
|
+
|
17
|
+
Breaking Changes
|
7
18
|
|
8
19
|
* Haml now requires Ruby 2.0.0 or above.
|
9
20
|
* Rails 3 is no longer supported, matching the official
|
10
21
|
[Maintenance Policy for Ruby on Rails](http://weblog.rubyonrails.org/2013/2/24/maintenance-policy-for-ruby-on-rails/).
|
11
22
|
(Tee Parham)
|
23
|
+
* The `haml` command's debug option (`-d`) no longer executes the Haml code, but
|
24
|
+
rather checks the generated Ruby syntax for errors.
|
25
|
+
* Drop parser/compiler accessor from `Haml::Engine`. Modify `Haml::Engine#initialize` options
|
26
|
+
or `Haml::Template.options` instead. (Takashi Kokubun)
|
27
|
+
* Drop dynamic quotes support and always escape `'` for `escape_html`/`escape_attrs` instead.
|
28
|
+
Also, escaped results are slightly changed and always unified to the same characters. (Takashi Kokubun)
|
29
|
+
* Don't preserve newlines in attributes. (Takashi Kokubun)
|
30
|
+
* HTML escape interpolated code in filters.
|
31
|
+
[#770](https://github.com/haml/haml/pull/770)
|
32
|
+
(Matt Wildig)
|
33
|
+
|
34
|
+
:javascript
|
35
|
+
#{JSON.generate(foo: "bar")}
|
36
|
+
Haml 4 output: {"foo":"bar"}
|
37
|
+
Haml 5 output: {"foo":"bar"}
|
38
|
+
|
39
|
+
Added
|
40
|
+
|
41
|
+
* Add a tracing option. When enabled, Haml will output a data-trace attribute on each tag showing the path
|
42
|
+
to the source Haml file from which it was generated. Thanks [Alex Babkin](https://github.com/ababkin).
|
43
|
+
* Add `haml_tag_if` to render a block, conditionally wrapped in another element (Matt Wildig)
|
44
|
+
* Support Rails 5.1 Erubi template handler.
|
45
|
+
* Support Sprockets 3. Thanks [Sam Davies](https://github.com/samphilipd) and [Jeremy Venezia](https://github.com/jvenezia).
|
46
|
+
* General performance and memory usage improvements. (Akira Matsuda)
|
47
|
+
* Analyze attribute values by Ripper and render static attributes beforehand. (Takashi Kokubun)
|
48
|
+
* Optimize attribute rendering about 3x faster. (Takashi Kokubun)
|
49
|
+
* Add temple gem as dependency and create `Haml::TempleEngine` class.
|
50
|
+
Some methods in `Haml::Compiler` are migrated to `Haml::TempleEngine`. (Takashi Kokubun)
|
51
|
+
|
52
|
+
Fixed
|
53
|
+
|
12
54
|
* Fix for attribute merging. When an attribute method (or literal nested hash)
|
13
55
|
was used in an old style attribute hash and there is also a (non-static) new
|
14
56
|
style hash there is an error. The fix can result in different behavior in
|
15
57
|
some circumstances. See the [commit message](https://github.com/haml/haml/tree/e475b015d3171fb4c4f140db304f7970c787d6e3)
|
16
58
|
for detailed info. (Matt Wildig)
|
17
59
|
* Make escape_once respect hexadecimal references. (Matt Wildig)
|
18
|
-
* General performance and memory usage improvements. (Akira Matsuda)
|
19
60
|
* Don't treat the 'data' attribute specially when merging attribute hashes. (Matt Wildig and Norman Clarke)
|
20
|
-
* Add a tracing option. When enabled, Haml will output a data-trace attribute on each tag showing the path
|
21
|
-
to the source Haml file from which it was generated. Thanks [Alex Babkin](https://github.com/ababkin).
|
22
61
|
* Fix #@foo and #$foo style interpolation that was not working in html_safe mode. (Akira Matsuda)
|
23
|
-
* Add `haml_tag_if` to render a block, conditionally wrapped in another element (Matt Wildig)
|
24
|
-
* Escape Ruby script interpolated in filters. (Matt Wildig)
|
25
|
-
* The `haml` command's debug option (`-d`) no longer executes the Haml code, but
|
26
|
-
rather checks the generated Ruby syntax for errors.
|
27
|
-
* Support Rails 5.1 Erubi template handler.
|
28
|
-
* Support Sprockets 3. Thanks [Sam Davies](https://github.com/samphilipd) and [Jeremy Venezia](https://github.com/jvenezia).
|
29
62
|
* Allow `@` as tag's class name. Thanks [Joe Bartlett](https://github.com/redoPop).
|
30
63
|
* Raise `Haml::InvalidAttributeNameError` when attribute name includes invalid characters. (Takashi Kokubun)
|
31
|
-
* Drop dynamic quotes support and always escape `'` for `escape_html`/`escape_attrs` instead.
|
32
|
-
Also, escaped results are slightly changed and always unified to the same characters. (Takashi Kokubun)
|
33
|
-
* Don't preserve newlines in attributes. (Takashi Kokubun)
|
34
|
-
* Add temple gem as dependency and create `Haml::TempleEngine` class.
|
35
|
-
Some methods in `Haml::Compiler` are migrated to `Haml::TempleEngine`. (Takashi Kokubun)
|
36
|
-
* Drop parser/compiler accessor from `Haml::Engine`. Modify `Haml::Engine#initialize` options
|
37
|
-
or `Haml::Template.options` instead. (Takashi Kokubun)
|
38
64
|
* Don't ignore unexpected exceptions on initializing `ActionView::OutputBuffer`. (Takashi Kokubun)
|
39
|
-
* Analyze attribute values by Ripper and render static attributes beforehand. (Takashi Kokubun)
|
40
|
-
* Optimize attribute rendering about 3x faster. (Takashi Kokubun)
|
41
65
|
|
42
66
|
## 4.0.7
|
43
67
|
|
data/Gemfile
ADDED
data/README.md
CHANGED
@@ -178,6 +178,7 @@ Haml currently supports Ruby 2.0.0 and higher, so please make sure your changes
|
|
178
178
|
* [Akira Matsuda](https://github.com/amatsuda)
|
179
179
|
* [Matt Wildig](https://github.com/mattwildig)
|
180
180
|
* [Tee Parham](https://github.com/teeparham)
|
181
|
+
* [Takashi Kokubun](https://github.com/k0kubun)
|
181
182
|
|
182
183
|
### Alumni
|
183
184
|
|
data/Rakefile
CHANGED
@@ -4,19 +4,13 @@ require "bundler/gem_tasks"
|
|
4
4
|
|
5
5
|
task :default => :test
|
6
6
|
|
7
|
-
#
|
7
|
+
#FIXME: Redefining :test task to run each test in isolated process.
|
8
8
|
# Remove this task when we finished changing escape_html option to be true by default.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
Rake::TestTask.new do |t|
|
16
|
-
t.libs << 'test'
|
17
|
-
t.test_files = Dir['test/*_test.rb'] + Dir['test/haml-spec/*_test.rb'] - isolated_test.file_list
|
18
|
-
t.warning = true
|
19
|
-
t.verbose = true
|
9
|
+
task :test do
|
10
|
+
test_files = Dir.glob('test/**/*_test.rb').reject { |f| f.start_with?('test/gemfiles/vendor/bundle') }
|
11
|
+
test_files.all? do |file|
|
12
|
+
sh(Gem.ruby, '-w', '-I/lib', '-Itest', file)
|
13
|
+
end || raise('Failures')
|
20
14
|
end
|
21
15
|
|
22
16
|
CLEAN.replace %w(pkg doc coverage .yardoc test/haml vendor)
|
data/TODO
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- mode: org -*-
|
2
|
+
#+STARTUP: nofold
|
3
|
+
|
4
|
+
* Documentation
|
5
|
+
Redo tutorial?
|
6
|
+
Using helpers
|
7
|
+
haml_concat and haml_tag in particular
|
8
|
+
Syntax highlighting?
|
9
|
+
|
10
|
+
* Code
|
11
|
+
Keep track of error offsets everywhere
|
12
|
+
Use this to show error location in messages
|
13
|
+
** Haml
|
14
|
+
Support finer-grained HTML-escaping in filters
|
15
|
+
Speed
|
16
|
+
Make tags with dynamic attributes pre-render as much as possible
|
17
|
+
Including the attribute name where doable
|
18
|
+
:html improvements
|
19
|
+
Ignore closing tags where we can
|
20
|
+
http://code.google.com/speed/articles/optimizing-html.html
|
21
|
+
Requires Haml parsing refactor
|
22
|
+
Don't quote attributes that don't require it
|
23
|
+
http://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.2.2
|
24
|
+
http://www.w3.org/TR/html5/syntax.html#attributes
|
data/benchmark.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "haml"
|
3
|
+
require "rbench"
|
4
|
+
|
5
|
+
times = (ARGV.first || 1000).to_i
|
6
|
+
|
7
|
+
if times == 0 # Invalid parameter
|
8
|
+
puts <<END
|
9
|
+
ruby #$0 [times=1000]
|
10
|
+
Benchmark Haml against various other templating languages.
|
11
|
+
END
|
12
|
+
exit 1
|
13
|
+
end
|
14
|
+
|
15
|
+
%w[erb erubis rails active_support action_controller
|
16
|
+
action_view action_pack haml/template rbench].each {|dep| require(dep)}
|
17
|
+
|
18
|
+
def view
|
19
|
+
base = ActionView::Base.new
|
20
|
+
base.view_paths << File.join(File.dirname(__FILE__), '/test')
|
21
|
+
base
|
22
|
+
end
|
23
|
+
|
24
|
+
def render(view, file)
|
25
|
+
view.render :file => file
|
26
|
+
end
|
27
|
+
|
28
|
+
RBench.run(times) do
|
29
|
+
column :haml, :title => "Haml"
|
30
|
+
column :erb, :title => "ERB"
|
31
|
+
column :erubis, :title => "Erubis"
|
32
|
+
|
33
|
+
template_name = 'standard'
|
34
|
+
haml_template = File.read("#{File.dirname(__FILE__)}/test/templates/#{template_name}.haml")
|
35
|
+
erb_template = File.read("#{File.dirname(__FILE__)}/test/erb/#{template_name}.erb")
|
36
|
+
|
37
|
+
report "Cached" do
|
38
|
+
obj = Object.new
|
39
|
+
|
40
|
+
Haml::Engine.new(haml_template).def_method(obj, :haml)
|
41
|
+
Erubis::Eruby.new(erb_template).def_method(obj, :erubis)
|
42
|
+
obj.instance_eval("def erb; #{ERB.new(erb_template, nil, '-').src}; end")
|
43
|
+
|
44
|
+
haml { obj.haml }
|
45
|
+
erb { obj.erb }
|
46
|
+
erubis { obj.erubis }
|
47
|
+
end
|
48
|
+
|
49
|
+
report "ActionView" do
|
50
|
+
# To cache the template
|
51
|
+
render view, 'templates/standard'
|
52
|
+
render view, 'erb/standard'
|
53
|
+
|
54
|
+
haml { render view, 'templates/standard' }
|
55
|
+
erb { render view, 'erb/standard' }
|
56
|
+
end
|
57
|
+
|
58
|
+
report "ActionView with deep partials" do
|
59
|
+
# To cache the template
|
60
|
+
render view, 'templates/action_view'
|
61
|
+
render view, 'erb/action_view'
|
62
|
+
|
63
|
+
haml { render view, 'templates/action_view' }
|
64
|
+
erb { render view, 'erb/action_view' }
|
65
|
+
end
|
66
|
+
end
|
data/haml.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
($LOAD_PATH << File.expand_path("../lib", __FILE__)).uniq!
|
2
|
+
require "haml/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = 'haml'
|
6
|
+
spec.summary = "An elegant, structured (X)HTML/XML templating engine."
|
7
|
+
spec.version = Haml::VERSION
|
8
|
+
spec.authors = ['Natalie Weizenbaum', 'Hampton Catlin', 'Norman Clarke', 'Akira Matsuda']
|
9
|
+
spec.email = ['haml@googlegroups.com', 'norman@njclarke.com']
|
10
|
+
|
11
|
+
readmes = Dir['*'].reject{ |x| x =~ /(^|[^.a-z])[a-z]+/ || x == "TODO" }
|
12
|
+
spec.executables = ['haml']
|
13
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
14
|
+
f.match(%r{\Atest/})
|
15
|
+
end
|
16
|
+
spec.homepage = 'http://haml.info/'
|
17
|
+
spec.has_rdoc = false
|
18
|
+
spec.test_files = Dir["test/**/*_test.rb"]
|
19
|
+
spec.license = "MIT"
|
20
|
+
|
21
|
+
spec.required_ruby_version = '>= 2.0.0'
|
22
|
+
|
23
|
+
spec.add_dependency 'temple', '>= 0.8.0'
|
24
|
+
spec.add_dependency 'tilt'
|
25
|
+
|
26
|
+
spec.add_development_dependency 'rails', '>= 4.0.0'
|
27
|
+
spec.add_development_dependency 'rbench'
|
28
|
+
spec.add_development_dependency 'minitest', '>= 4.0'
|
29
|
+
spec.add_development_dependency 'nokogiri'
|
30
|
+
|
31
|
+
spec.description = <<-END
|
32
|
+
Haml (HTML Abstraction Markup Language) is a layer on top of HTML or XML that's
|
33
|
+
designed to express the structure of documents in a non-repetitive, elegant, and
|
34
|
+
easy way by using indentation rather than closing tags and allowing Ruby to be
|
35
|
+
embedded with ease. It was originally envisioned as a plugin for Ruby on Rails,
|
36
|
+
but it can function as a stand-alone templating engine.
|
37
|
+
END
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
version.rb merge=ours
|
@@ -131,6 +131,10 @@ module Haml
|
|
131
131
|
open_tokens[:paren] += 1
|
132
132
|
when :on_rparen
|
133
133
|
open_tokens[:paren] -= 1
|
134
|
+
when :on_embexpr_beg
|
135
|
+
open_tokens[:embexpr] += 1
|
136
|
+
when :on_embexpr_end
|
137
|
+
open_tokens[:embexpr] -= 1
|
134
138
|
when *IGNORED_TYPES
|
135
139
|
next if attr_tokens.empty?
|
136
140
|
end
|
data/lib/haml/compiler.rb
CHANGED
@@ -14,6 +14,7 @@ module Haml
|
|
14
14
|
@to_merge = []
|
15
15
|
@temple = [:multi]
|
16
16
|
@node = nil
|
17
|
+
@filters = Filters.defined.merge(options[:filters])
|
17
18
|
@attribute_compiler = AttributeCompiler.new(@options)
|
18
19
|
end
|
19
20
|
|
@@ -168,7 +169,7 @@ module Haml
|
|
168
169
|
end
|
169
170
|
|
170
171
|
def compile_filter
|
171
|
-
unless filter =
|
172
|
+
unless filter = @filters[@node.value[:name]]
|
172
173
|
name = @node.value[:name]
|
173
174
|
if ["maruku", "textile"].include?(name)
|
174
175
|
raise Error.new(Error.message(:install_haml_contrib, name), @node.line - 1)
|
@@ -15,13 +15,5 @@ module Haml
|
|
15
15
|
@options.merge! engine_class: Haml::ErubiTemplateHandler
|
16
16
|
super
|
17
17
|
end
|
18
|
-
|
19
|
-
def precompiled_preamble(locals)
|
20
|
-
[super, "@output_buffer = ActionView::OutputBuffer.new;"].join("\n")
|
21
|
-
end
|
22
|
-
|
23
|
-
def precompiled_postamble(locals)
|
24
|
-
[super, '@output_buffer.to_s'].join("\n")
|
25
|
-
end
|
26
18
|
end
|
27
19
|
end
|
data/lib/haml/options.rb
CHANGED
@@ -164,6 +164,9 @@ module Haml
|
|
164
164
|
# the path will be the full path.
|
165
165
|
attr_accessor :trace
|
166
166
|
|
167
|
+
# Key is filter name in String and value is Class to use. Defaults to {}.
|
168
|
+
attr_accessor :filters
|
169
|
+
|
167
170
|
def initialize(values = {}, &block)
|
168
171
|
defaults.each {|k, v| instance_variable_set :"@#{k}", v}
|
169
172
|
values.each {|k, v| send("#{k}=", v) if defaults.has_key?(k) && !v.nil?}
|
data/lib/haml/railtie.rb
CHANGED
@@ -9,6 +9,14 @@ if (activesupport_spec = Gem.loaded_specs['activesupport'])
|
|
9
9
|
end
|
10
10
|
|
11
11
|
module Haml
|
12
|
+
module Filters
|
13
|
+
module RailsErb
|
14
|
+
extend Plain
|
15
|
+
extend TiltFilter
|
16
|
+
extend PrecompiledTiltFilter
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
12
20
|
class Railtie < ::Rails::Railtie
|
13
21
|
initializer :haml do |app|
|
14
22
|
ActiveSupport.on_load(:action_view) do
|
@@ -20,11 +28,12 @@ module Haml
|
|
20
28
|
|
21
29
|
if defined? Erubi
|
22
30
|
require "haml/helpers/safe_erubi_template"
|
23
|
-
Haml::Filters::
|
31
|
+
Haml::Filters::RailsErb.template_class = Haml::SafeErubiTemplate
|
24
32
|
else
|
25
33
|
require "haml/helpers/safe_erubis_template"
|
26
|
-
Haml::Filters::
|
34
|
+
Haml::Filters::RailsErb.template_class = Haml::SafeErubisTemplate
|
27
35
|
end
|
36
|
+
Haml::Template.options[:filters] = { 'erb' => Haml::Filters::RailsErb }
|
28
37
|
end
|
29
38
|
end
|
30
39
|
end
|