haml 4.0.6 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +19 -0
- data/.gitmodules +3 -0
- data/.travis.yml +72 -0
- data/.yardopts +2 -3
- data/CHANGELOG.md +138 -4
- data/FAQ.md +4 -14
- data/Gemfile +16 -0
- data/MIT-LICENSE +2 -2
- data/README.md +79 -42
- data/REFERENCE.md +142 -67
- data/Rakefile +44 -63
- data/TODO +24 -0
- data/benchmark.rb +70 -0
- data/haml.gemspec +45 -0
- data/lib/haml.rb +2 -0
- data/lib/haml/.gitattributes +1 -0
- data/lib/haml/attribute_builder.rb +164 -0
- data/lib/haml/attribute_compiler.rb +235 -0
- data/lib/haml/attribute_parser.rb +150 -0
- data/lib/haml/buffer.rb +29 -136
- data/lib/haml/compiler.rb +110 -320
- data/lib/haml/engine.rb +34 -41
- data/lib/haml/error.rb +28 -24
- data/lib/haml/escapable.rb +77 -0
- data/lib/haml/exec.rb +38 -20
- data/lib/haml/filters.rb +22 -27
- data/lib/haml/generator.rb +42 -0
- data/lib/haml/helpers.rb +134 -89
- data/lib/haml/helpers/action_view_extensions.rb +4 -2
- data/lib/haml/helpers/action_view_mods.rb +45 -60
- data/lib/haml/helpers/action_view_xss_mods.rb +2 -0
- data/lib/haml/helpers/safe_erubi_template.rb +20 -0
- data/lib/haml/helpers/safe_erubis_template.rb +5 -1
- data/lib/haml/helpers/xss_mods.rb +23 -13
- data/lib/haml/options.rb +63 -69
- data/lib/haml/parser.rb +292 -228
- data/lib/haml/plugin.rb +37 -0
- data/lib/haml/railtie.rb +38 -12
- data/lib/haml/sass_rails_filter.rb +18 -4
- data/lib/haml/template.rb +13 -6
- data/lib/haml/template/options.rb +13 -2
- data/lib/haml/temple_engine.rb +123 -0
- data/lib/haml/temple_line_counter.rb +30 -0
- data/lib/haml/util.rb +83 -202
- data/lib/haml/version.rb +3 -1
- 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 +73 -108
- data/lib/haml/template/plugin.rb +0 -41
- data/test/engine_test.rb +0 -2013
- 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/filters_test.rb +0 -254
- data/test/gemfiles/Gemfile.rails-3.0.x +0 -5
- data/test/gemfiles/Gemfile.rails-3.1.x +0 -6
- data/test/gemfiles/Gemfile.rails-3.2.x +0 -5
- data/test/gemfiles/Gemfile.rails-4.0.x +0 -5
- data/test/helper_test.rb +0 -583
- data/test/markaby/standard.mab +0 -52
- data/test/mocks/article.rb +0 -6
- data/test/parser_test.rb +0 -105
- data/test/results/content_for_layout.xhtml +0 -12
- data/test/results/eval_suppressed.xhtml +0 -9
- data/test/results/helpers.xhtml +0 -70
- data/test/results/helpful.xhtml +0 -10
- data/test/results/just_stuff.xhtml +0 -70
- data/test/results/list.xhtml +0 -12
- data/test/results/nuke_inner_whitespace.xhtml +0 -40
- data/test/results/nuke_outer_whitespace.xhtml +0 -148
- data/test/results/original_engine.xhtml +0 -20
- data/test/results/partial_layout.xhtml +0 -5
- data/test/results/partial_layout_erb.xhtml +0 -5
- data/test/results/partials.xhtml +0 -21
- data/test/results/render_layout.xhtml +0 -3
- data/test/results/silent_script.xhtml +0 -74
- data/test/results/standard.xhtml +0 -162
- data/test/results/tag_parsing.xhtml +0 -23
- data/test/results/very_basic.xhtml +0 -5
- data/test/results/whitespace_handling.xhtml +0 -90
- data/test/template_test.rb +0 -354
- data/test/templates/_av_partial_1.haml +0 -9
- data/test/templates/_av_partial_1_ugly.haml +0 -9
- data/test/templates/_av_partial_2.haml +0 -5
- data/test/templates/_av_partial_2_ugly.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/action_view_ugly.haml +0 -47
- 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 -85
- 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 -43
- 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/test_helper.rb +0 -81
- data/test/util_test.rb +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ccbf9b5c93745c83284467b77b73dd156f049dacf55861dd486bd14404d84e84
|
4
|
+
data.tar.gz: 4e2439c5e370db4bd765ca76ab4d76c027d9a9f9f6b68e5d38761e6858f3312f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0c7b716e9866070fc50281e4486eb519832c3f098cbd58bb62ca18f2659ca85bc44cd6a275121fe71f37f8d9e442ac9b75f254b28747b5fbff47a98b1e633c5
|
7
|
+
data.tar.gz: 3e870080f42d925cddc479a52318d2cb8e6a9dbfd5613e8027c0c4dfd80e4f7636fa9f50cd41d3eca6f72f12bcc1cc7e5a5b2b9120223e1e6218ad8d6dcf9ca8
|
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
sudo: false
|
2
|
+
dist: trusty
|
3
|
+
language: ruby
|
4
|
+
cache:
|
5
|
+
bundler: true
|
6
|
+
rvm:
|
7
|
+
- ruby-head
|
8
|
+
- 2.7
|
9
|
+
- 2.6
|
10
|
+
- 2.5
|
11
|
+
- jruby-9.2
|
12
|
+
gemfile:
|
13
|
+
- test/gemfiles/Gemfile.rails-6.0.x
|
14
|
+
- test/gemfiles/Gemfile.rails-5.2.x
|
15
|
+
- test/gemfiles/Gemfile.rails-5.1.x
|
16
|
+
- test/gemfiles/Gemfile.rails-5.0.x
|
17
|
+
- test/gemfiles/Gemfile.rails-5.0.x.erubi
|
18
|
+
- test/gemfiles/Gemfile.rails-4.2.x
|
19
|
+
- test/gemfiles/Gemfile.rails-4.1.x
|
20
|
+
- test/gemfiles/Gemfile.rails-4.0.x
|
21
|
+
matrix:
|
22
|
+
exclude:
|
23
|
+
- rvm: 2.5
|
24
|
+
gemfile: test/gemfiles/Gemfile.rails-4.0.x
|
25
|
+
- rvm: 2.5
|
26
|
+
gemfile: test/gemfiles/Gemfile.rails-4.1.x
|
27
|
+
- rvm: 2.5
|
28
|
+
gemfile: test/gemfiles/Gemfile.rails-4.2.x
|
29
|
+
- rvm: 2.6
|
30
|
+
gemfile: test/gemfiles/Gemfile.rails-4.0.x
|
31
|
+
- rvm: 2.6
|
32
|
+
gemfile: test/gemfiles/Gemfile.rails-4.1.x
|
33
|
+
- rvm: 2.6
|
34
|
+
gemfile: test/gemfiles/Gemfile.rails-4.2.x
|
35
|
+
- rvm: 2.7
|
36
|
+
gemfile: test/gemfiles/Gemfile.rails-4.0.x
|
37
|
+
- rvm: 2.7
|
38
|
+
gemfile: test/gemfiles/Gemfile.rails-4.1.x
|
39
|
+
- rvm: 2.7
|
40
|
+
gemfile: test/gemfiles/Gemfile.rails-4.2.x
|
41
|
+
- rvm: ruby-head
|
42
|
+
gemfile: test/gemfiles/Gemfile.rails-4.0.x
|
43
|
+
- rvm: ruby-head
|
44
|
+
gemfile: test/gemfiles/Gemfile.rails-4.1.x
|
45
|
+
- rvm: ruby-head
|
46
|
+
gemfile: test/gemfiles/Gemfile.rails-4.2.x
|
47
|
+
include:
|
48
|
+
- rvm: 2.7
|
49
|
+
gemfile: test/gemfiles/Gemfile.rails-edge
|
50
|
+
allow_failures:
|
51
|
+
- rvm: ruby-head
|
52
|
+
- gemfile: test/gemfiles/Gemfile.rails-edge
|
53
|
+
- rvm: jruby-9.2
|
54
|
+
gemfile: test/gemfiles/Gemfile.rails-4.2.x
|
55
|
+
- rvm: jruby-9.2
|
56
|
+
gemfile: test/gemfiles/Gemfile.rails-4.1.x
|
57
|
+
- rvm: jruby-9.2
|
58
|
+
gemfile: test/gemfiles/Gemfile.rails-4.0.x
|
59
|
+
- rvm: jruby-9.2
|
60
|
+
gemfile: test/gemfiles/Gemfile.rails-5.0.x.erubi
|
61
|
+
fast_finish: true
|
62
|
+
before_install:
|
63
|
+
# install older versions of rubygems and bundler only on Ruby < 2.7
|
64
|
+
- if [ `echo "${TRAVIS_RUBY_VERSION:0:3} < 2.7" | bc` == 1 ]; then gem i rubygems-update -v '<3' && update_rubygems; fi; # https://github.com/travis-ci/travis-ci/issues/8974
|
65
|
+
- if [ `echo "${TRAVIS_RUBY_VERSION:0:3} < 2.7" | bc` == 1 ]; then gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true; fi;
|
66
|
+
- if [ `echo "${TRAVIS_RUBY_VERSION:0:3} < 2.7" | bc` == 1 ]; then gem i bundler -v '<2'; fi;
|
67
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
68
|
+
- chmod +x ./cc-test-reporter
|
69
|
+
- ./cc-test-reporter before-build
|
70
|
+
script: "bundle exec rake submodules test"
|
71
|
+
after_script:
|
72
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/.yardopts
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--charset utf-8
|
2
2
|
--readme README.md
|
3
3
|
--markup markdown
|
4
|
-
--markup-provider
|
4
|
+
--markup-provider kramdown
|
5
5
|
--template-path yard
|
6
6
|
--default-return ""
|
7
7
|
--title "Haml Documentation"
|
8
8
|
--query 'object.type != :classvariable'
|
9
9
|
--query 'object.type != :constant || @api && @api.text == "public"'
|
10
|
-
--exclude lib/haml/
|
11
|
-
--exclude lib/haml/template/plugin.rb
|
10
|
+
--exclude lib/haml/plugin.rb
|
12
11
|
--exclude lib/haml/railtie.rb
|
13
12
|
--exclude lib/haml/helpers/action_view_mods.rb
|
14
13
|
--exclude lib/haml/helpers/xss_mods.rb
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,145 @@
|
|
1
1
|
# Haml Changelog
|
2
2
|
|
3
|
+
## 5.2
|
4
|
+
|
5
|
+
Released on September 28, 2020
|
6
|
+
([diff](https://github.com/haml/haml/compare/v5.1.2...v5.2)).
|
7
|
+
|
8
|
+
* Fix crash in the attribute optimizer when `#inspect` is overridden in TrueClass / FalseClass [#972](https://github.com/haml/haml/issues/972)
|
9
|
+
* Do not HTML-escape templates that are declared to be plaintext [#1014](https://github.com/haml/haml/issues/1014) (Thanks [@cesarizu](https://github.com/cesarizu))
|
10
|
+
* Class names are no longer ordered alphabetically, and now follow a new specification as laid out in REFERENCE [#306](https://github.com/haml/haml/issues/306)
|
11
|
+
|
12
|
+
## 5.1.2
|
13
|
+
|
14
|
+
Released on August 6, 2019
|
15
|
+
([diff](https://github.com/haml/haml/compare/v5.1.1...v5.1.2)).
|
16
|
+
|
17
|
+
* Fix crash in some environments such as New Relic by unfreezing string literals for ParseNode#inspect. [#1016](https://github.com/haml/haml/pull/1016) (thanks [Jalyna](https://github.com/jalyna))
|
18
|
+
|
19
|
+
## 5.1.1
|
20
|
+
|
21
|
+
Released on May 25, 2019
|
22
|
+
([diff](https://github.com/haml/haml/compare/v5.1.0...v5.1.1)).
|
23
|
+
|
24
|
+
* Fix NameError bug that happens on ruby 2.6.1-2.6.3 + haml 5.1.0 + rails < 5.1 + erubi. (Akira Matsuda)
|
25
|
+
|
26
|
+
## 5.1.0
|
27
|
+
|
28
|
+
Released on May 16, 2019
|
29
|
+
([diff](https://github.com/haml/haml/compare/v5.0.4...v5.1.0)).
|
30
|
+
|
31
|
+
* Rails 6 support [#1008](https://github.com/haml/haml/pull/1008) (thanks [Seb Jacobs](https://github.com/sebjacobs))
|
32
|
+
* Add `escape_filter_interpolations` option for backwards compatibility with haml 4 defaults [#984](https://github.com/haml/haml/pull/984) (thanks [Will Jordan](https://github.com/wjordan))
|
33
|
+
* Fix error on empty :javascript and :css filter blocks [#986](https://github.com/haml/haml/pull/986) (thanks [Will Jordan](https://github.com/wjordan))
|
34
|
+
* Respect changes in Haml::Options.defaults in `Haml::TempleEngine` options (Takashi Kokubun)
|
35
|
+
* Un-freeze TempleEngine precompiled string literals [#983](https://github.com/haml/haml/pull/983) (thanks [Will Jordan](https://github.com/wjordan))
|
36
|
+
* Various performance/memory improvements [#965](https://github.com/haml/haml/pull/965), [#966](https://github.com/haml/haml/pull/966), [#963](https://github.com/haml/haml/pull/963) (thanks [Dillon Welch](https://github.com/oniofchaos))
|
37
|
+
* Enable `frozen_string_literal` magic comment for all .rb files [#967](https://github.com/haml/haml/pull/967) (thanks [Dillon Welch](https://github.com/oniofchaos))
|
38
|
+
|
39
|
+
## 5.0.4
|
40
|
+
|
41
|
+
Released on October 13, 2017
|
42
|
+
([diff](https://github.com/haml/haml/compare/v5.0.3...v5.0.4)).
|
43
|
+
|
44
|
+
* Fix `haml -c --stdin` regression in 5.0.2. [#958](https://github.com/haml/haml/pull/958) (thanks [Timo Göllner](https://github.com/TeaMoe))
|
45
|
+
* Ruby 2.5 support (it wasn't working due to Ripper API change). (Akira Matsuda)
|
46
|
+
|
47
|
+
## 5.0.3
|
48
|
+
|
49
|
+
Released on September 7, 2017
|
50
|
+
([diff](https://github.com/haml/haml/compare/v5.0.2...v5.0.3)).
|
51
|
+
|
52
|
+
* Use `String#dump` instead of `String#inspect` to generate string literal. (Takashi Kokubun)
|
53
|
+
* Fix Erubi superclass mismatch error. [#952](https://github.com/haml/haml/pull/952) (thanks [Robin Daugherty](https://github.com/RobinDaugherty))
|
54
|
+
|
55
|
+
## 5.0.2
|
56
|
+
|
57
|
+
Released on August 1, 2017
|
58
|
+
([diff](https://github.com/haml/haml/compare/v5.0.1...v5.0.2)).
|
59
|
+
|
60
|
+
* Let `haml -c` fail if generated Ruby code is syntax error. [#880](https://github.com/haml/haml/issues/880) (Takashi Kokubun)
|
61
|
+
* Fix `NoMethodError` bug caused with Sprockets 3 and :sass filter. [#930](https://github.com/haml/haml/pull/930) (thanks [Gonzalez Maximiliano](https://github.com/emaxi))
|
62
|
+
* Fix `list_of` helper with multi-line content. [#933](https://github.com/haml/haml/pull/933) (thanks [Benoit Larroque](https://github.com/zetaben))
|
63
|
+
* Optimize rendering performance by changing timing to fix textareas. [#941](https://github.com/haml/haml/pull/941) (Takashi Kokubun)
|
64
|
+
* Fix `TypeError` with empty :ruby filter. [#942](https://github.com/haml/haml/pull/942) (Takashi Kokubun)
|
65
|
+
* Fix inconsistent attribute sort order. (Takashi Kokubun)
|
66
|
+
|
67
|
+
## 5.0.1
|
68
|
+
|
69
|
+
Released on May 3, 2017
|
70
|
+
([diff](https://github.com/haml/haml/compare/v5.0.0...v5.0.1)).
|
71
|
+
|
72
|
+
* Fix parsing attributes including string interpolation. [#917](https://github.com/haml/haml/pull/917) [#921](https://github.com/haml/haml/issues/921)
|
73
|
+
* Stop distributing test files in gem package and allow installing on Windows.
|
74
|
+
* Use ActionView's Erubi/Erubis handler for erb filter only on ActionView. [#914](https://github.com/haml/haml/pull/914)
|
75
|
+
|
76
|
+
## 5.0.0
|
77
|
+
|
78
|
+
Released on April 26, 2017
|
79
|
+
([diff](https://github.com/haml/haml/compare/4.0.7...v5.0.0)).
|
80
|
+
|
81
|
+
Breaking Changes
|
82
|
+
|
83
|
+
* Haml now requires Ruby 2.0.0 or above.
|
84
|
+
* Rails 3 is no longer supported, matching the official
|
85
|
+
[Maintenance Policy for Ruby on Rails](http://weblog.rubyonrails.org/2013/2/24/maintenance-policy-for-ruby-on-rails/).
|
86
|
+
Use Haml 4 if you want to use Rails 3.
|
87
|
+
(Tee Parham)
|
88
|
+
* Remove `:ugly` option ([#894](https://github.com/haml/haml/pull/894))
|
89
|
+
* The `haml` command's debug option (`-d`) no longer executes the Haml code, but
|
90
|
+
rather checks the generated Ruby syntax for errors.
|
91
|
+
* Drop parser/compiler accessor from `Haml::Engine`. Modify `Haml::Engine#initialize` options
|
92
|
+
or `Haml::Template.options` instead. (Takashi Kokubun)
|
93
|
+
* Drop dynamic quotes support and always escape `'` for `escape_html`/`escape_attrs` instead.
|
94
|
+
Also, escaped results are slightly changed and always unified to the same characters. (Takashi Kokubun)
|
95
|
+
* Don't preserve newlines in attributes. (Takashi Kokubun)
|
96
|
+
* HTML escape interpolated code in filters.
|
97
|
+
[#770](https://github.com/haml/haml/pull/770)
|
98
|
+
(Matt Wildig)
|
99
|
+
|
100
|
+
:javascript
|
101
|
+
#{JSON.generate(foo: "bar")}
|
102
|
+
Haml 4 output: {"foo":"bar"}
|
103
|
+
Haml 5 output: {"foo":"bar"}
|
104
|
+
|
105
|
+
Added
|
106
|
+
|
107
|
+
* Add a tracing option. When enabled, Haml will output a data-trace attribute on each tag showing the path
|
108
|
+
to the source Haml file from which it was generated. Thanks [Alex Babkin](https://github.com/ababkin).
|
109
|
+
* Add `haml_tag_if` to render a block, conditionally wrapped in another element (Matt Wildig)
|
110
|
+
* Support Rails 5.1 Erubi template handler.
|
111
|
+
* Support Sprockets 3. Thanks [Sam Davies](https://github.com/samphilipd) and [Jeremy Venezia](https://github.com/jvenezia).
|
112
|
+
* General performance and memory usage improvements. (Akira Matsuda)
|
113
|
+
* Analyze attribute values by Ripper and render static attributes beforehand. (Takashi Kokubun)
|
114
|
+
* Optimize attribute rendering about 3x faster. (Takashi Kokubun)
|
115
|
+
* Add temple gem as dependency and create `Haml::TempleEngine` class.
|
116
|
+
Some methods in `Haml::Compiler` are migrated to `Haml::TempleEngine`. (Takashi Kokubun)
|
117
|
+
|
118
|
+
Fixed
|
119
|
+
|
120
|
+
* Fix for attribute merging. When an attribute method (or literal nested hash)
|
121
|
+
was used in an old style attribute hash and there is also a (non-static) new
|
122
|
+
style hash there is an error. The fix can result in different behavior in
|
123
|
+
some circumstances. See the [commit message](https://github.com/haml/haml/tree/e475b015d3171fb4c4f140db304f7970c787d6e3)
|
124
|
+
for detailed info. (Matt Wildig)
|
125
|
+
* Make escape_once respect hexadecimal references. (Matt Wildig)
|
126
|
+
* Don't treat the 'data' attribute specially when merging attribute hashes. (Matt Wildig and Norman Clarke)
|
127
|
+
* Fix #@foo and #$foo style interpolation that was not working in html_safe mode. (Akira Matsuda)
|
128
|
+
* Allow `@` as tag's class name. Thanks [Joe Bartlett](https://github.com/redoPop).
|
129
|
+
* Raise `Haml::InvalidAttributeNameError` when attribute name includes invalid characters. (Takashi Kokubun)
|
130
|
+
* Don't ignore unexpected exceptions on initializing `ActionView::OutputBuffer`. (Takashi Kokubun)
|
131
|
+
|
132
|
+
## 4.0.7
|
133
|
+
|
134
|
+
Released on August 10, 2015
|
135
|
+
([diff](https://github.com/haml/haml/compare/4.0.6...4.0.7)).
|
136
|
+
|
137
|
+
* Significantly improve performance of regexp used to fix whitespace handling in textareas (thanks [Stan Hu](https://github.com/stanhu)).
|
138
|
+
|
3
139
|
## 4.0.6
|
4
140
|
|
5
141
|
Released on Dec 1, 2014 ([diff](https://github.com/haml/haml/compare/4.0.5...4.0.6)).
|
6
142
|
|
7
|
-
|
8
143
|
* Fix warning on Ruby 1.8.7 "regexp has invalid interval" (thanks [Elia Schito](https://github.com/elia)).
|
9
144
|
|
10
145
|
## 4.0.5
|
@@ -69,7 +204,7 @@ Released March 21, 2013 ([diff](https://github.com/haml/haml/compare/4.0.0...4.0
|
|
69
204
|
|
70
205
|
## 4.0.0
|
71
206
|
|
72
|
-
* The Haml
|
207
|
+
* The Haml executable now accepts an `--autoclose` option. You can now
|
73
208
|
specify a list of tags that should be autoclosed
|
74
209
|
|
75
210
|
* The `:ruby` filter no longer redirects $stdout to the Haml document, as this
|
@@ -106,7 +241,7 @@ Released March 21, 2013 ([diff](https://github.com/haml/haml/compare/4.0.0...4.0
|
|
106
241
|
|
107
242
|
* All Hash attribute values are now treated as HTML5 data, regardless of key.
|
108
243
|
Previously only the "data" key was treated this way. Allowing arbitrary keys
|
109
|
-
means you can now easily use this
|
244
|
+
means you can now easily use this feature for Aria attributes, among other
|
110
245
|
uses.
|
111
246
|
(thanks to [Elvin Efendi](https://github.com/ElvinEfendi))
|
112
247
|
|
@@ -525,7 +660,6 @@ The {file:HAML_REFERENCE.md#ugly-option `:ugly` option} is now on by default
|
|
525
660
|
in the testing environment in Rails to help tests run faster.
|
526
661
|
|
527
662
|
## 3.0.0
|
528
|
-
{#3-0-0}
|
529
663
|
|
530
664
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.0).
|
531
665
|
|
data/FAQ.md
CHANGED
@@ -2,14 +2,7 @@
|
|
2
2
|
|
3
3
|
## Haml
|
4
4
|
|
5
|
-
###
|
6
|
-
{#q-indentation-in-production}
|
7
|
-
|
8
|
-
To improve performance, Haml defaults to {Haml::Options#ugly "ugly" mode} in
|
9
|
-
Rails apps running in production.
|
10
|
-
|
11
|
-
### How do I put a punctuation mark after an element, like "`I like <strong>cake</strong>!`"?
|
12
|
-
{#q-punctuation}
|
5
|
+
### How do I put a punctuation mark after an element, like "`I like <strong>cake</strong>!`"? {#q-punctuation}
|
13
6
|
|
14
7
|
Expressing the structure of a document
|
15
8
|
and expressing inline formatting are two very different problems.
|
@@ -37,8 +30,7 @@ then it's even easier:
|
|
37
30
|
|
38
31
|
%p== I like #{link_to 'chocolate', 'http://franschocolates.com'}!
|
39
32
|
|
40
|
-
### How do I stop Haml from indenting the contents of my `pre` and `textarea` tags?
|
41
|
-
{#q-preserve}
|
33
|
+
### How do I stop Haml from indenting the contents of my `pre` and `textarea` tags? {#q-preserve}
|
42
34
|
|
43
35
|
Because Haml automatically indents the HTML source code,
|
44
36
|
the contents of whitespace-sensitive tags like `pre` and `textarea`
|
@@ -78,8 +70,7 @@ and renders
|
|
78
70
|
|
79
71
|
<p><textarea>Foo
Bar</textarea></p>
|
80
72
|
|
81
|
-
### How do I make my long lines of Ruby code look nicer in my Haml document?
|
82
|
-
{#q-multiline}
|
73
|
+
### How do I make my long lines of Ruby code look nicer in my Haml document? {#q-multiline}
|
83
74
|
|
84
75
|
Put them in a helper or your model.
|
85
76
|
|
@@ -125,8 +116,7 @@ in Haml, you have to do
|
|
125
116
|
- form_for stuff do
|
126
117
|
...
|
127
118
|
|
128
|
-
### I have Haml installed. Why is Rails (only looking for `.html.erb` files | rendering Haml files as plain text | rendering Haml files as blank pages)?
|
129
|
-
{#q-blank-page}
|
119
|
+
### I have Haml installed. Why is Rails (only looking for `.html.erb` files | rendering Haml files as plain text | rendering Haml files as blank pages)? {#q-blank-page}
|
130
120
|
|
131
121
|
There are several reasons these things might be happening.
|
132
122
|
First of all, make sure that Haml really is installed;
|
data/Gemfile
ADDED
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2006-
|
1
|
+
Copyright (c) 2006-2019 Hampton Catlin and Natalie Weizenbaum
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
17
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Haml
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/haml.svg)](http://rubygems.org/gems/haml)
|
4
|
+
[![Build Status](https://travis-ci.org/haml/haml.svg?branch=main)](http://travis-ci.org/haml/haml)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/haml/haml/badges/gpa.svg)](https://codeclimate.com/github/haml/haml)
|
6
|
+
[![Inline docs](http://inch-ci.org/github/haml/haml.png)](http://inch-ci.org/github/haml/haml)
|
4
7
|
|
5
8
|
Haml is a templating engine for HTML. It's designed to make it both easier and
|
6
9
|
more pleasant to write HTML documents, by eliminating redundancy, reflecting the
|
@@ -12,23 +15,32 @@ that's both powerful and easy to understand.
|
|
12
15
|
Haml can be used from the command line or as part of a Ruby web framework. The
|
13
16
|
first step is to install the gem:
|
14
17
|
|
15
|
-
|
18
|
+
~~~sh
|
19
|
+
gem install haml
|
20
|
+
~~~
|
16
21
|
|
17
22
|
After you write some Haml, you can run
|
18
23
|
|
19
|
-
|
24
|
+
~~~sh
|
25
|
+
haml document.haml
|
26
|
+
~~~
|
20
27
|
|
21
28
|
to compile it to HTML. For more information on these commands, check out
|
22
29
|
|
23
|
-
|
30
|
+
~~~sh
|
31
|
+
haml --help
|
32
|
+
~~~
|
24
33
|
|
25
|
-
To use Haml
|
26
|
-
documentation](http://haml.info/docs/yardoc/).
|
34
|
+
To use Haml programmatically, check out the [YARD documentation](http://haml.info/docs/yardoc/).
|
27
35
|
|
28
36
|
## Using Haml with Rails
|
29
37
|
|
30
38
|
To use Haml with Rails, simply add Haml to your Gemfile and run `bundle`.
|
31
39
|
|
40
|
+
~~~ruby
|
41
|
+
gem 'haml'
|
42
|
+
~~~
|
43
|
+
|
32
44
|
If you'd like to replace Rails's Erb-based generators with Haml, add
|
33
45
|
[haml-rails](https://github.com/indirect/haml-rails) to your Gemfile as well.
|
34
46
|
|
@@ -36,58 +48,76 @@ If you'd like to replace Rails's Erb-based generators with Haml, add
|
|
36
48
|
|
37
49
|
The most basic element of Haml is a shorthand for creating HTML:
|
38
50
|
|
39
|
-
|
51
|
+
~~~haml
|
52
|
+
%tagname{:attr1 => 'value1', :attr2 => 'value2'} Contents
|
53
|
+
~~~
|
40
54
|
|
41
55
|
No end-tag is needed; Haml handles that automatically. If you prefer HTML-style
|
42
56
|
attributes, you can also use:
|
43
57
|
|
44
|
-
|
58
|
+
~~~haml
|
59
|
+
%tagname(attr1='value1' attr2='value2') Contents
|
60
|
+
~~~
|
45
61
|
|
46
62
|
Adding `class` and `id` attributes is even easier. Haml uses the same syntax as
|
47
63
|
the CSS that styles the document:
|
48
64
|
|
49
|
-
|
65
|
+
~~~haml
|
66
|
+
%tagname#id.class
|
67
|
+
~~~
|
50
68
|
|
51
69
|
In fact, when you're using the `<div>` tag, it becomes _even easier_. Because
|
52
70
|
`<div>` is such a common element, a tag without a name defaults to a div. So
|
53
71
|
|
54
|
-
|
72
|
+
~~~haml
|
73
|
+
#foo Hello!
|
74
|
+
~~~
|
55
75
|
|
56
76
|
becomes
|
57
77
|
|
58
|
-
|
78
|
+
~~~html
|
79
|
+
<div id='foo'>Hello!</div>
|
80
|
+
~~~
|
59
81
|
|
60
82
|
Haml uses indentation to bring the individual elements to represent the HTML
|
61
83
|
structure. A tag's children are indented beneath than the parent tag. Again, a
|
62
84
|
closing tag is automatically added. For example:
|
63
85
|
|
64
|
-
|
65
|
-
|
66
|
-
|
86
|
+
~~~haml
|
87
|
+
%ul
|
88
|
+
%li Salt
|
89
|
+
%li Pepper
|
90
|
+
~~~
|
67
91
|
|
68
92
|
becomes:
|
69
93
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
94
|
+
~~~html
|
95
|
+
<ul>
|
96
|
+
<li>Salt</li>
|
97
|
+
<li>Pepper</li>
|
98
|
+
</ul>
|
99
|
+
~~~
|
74
100
|
|
75
101
|
You can also put plain text as a child of an element:
|
76
102
|
|
77
|
-
|
78
|
-
|
79
|
-
|
103
|
+
~~~haml
|
104
|
+
%p
|
105
|
+
Hello,
|
106
|
+
World!
|
107
|
+
~~~
|
80
108
|
|
81
109
|
It's also possible to embed Ruby code into Haml documents. An equals sign, `=`,
|
82
110
|
will output the result of the code. A hyphen, `-`, will run the code but not
|
83
111
|
output the result. You can even use control statements like `if` and `while`:
|
84
112
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
113
|
+
~~~haml
|
114
|
+
%p
|
115
|
+
Date/Time:
|
116
|
+
- now = DateTime.now
|
117
|
+
%strong= now
|
118
|
+
- if now > DateTime.parse("December 31, 2006")
|
119
|
+
= "Happy new " + "year!"
|
120
|
+
~~~
|
91
121
|
|
92
122
|
Haml provides far more tools than those presented here. Check out the [reference
|
93
123
|
documentation](http://haml.info/docs/yardoc/file.REFERENCE.html)
|
@@ -105,18 +135,22 @@ Contributions are welcomed, but before you get started please read the
|
|
105
135
|
[guidelines](http://haml.info/development.html#contributing).
|
106
136
|
|
107
137
|
After forking and then cloning the repo locally, install Bundler and then use it
|
108
|
-
to install the development gem
|
109
|
-
|
110
|
-
|
111
|
-
|
138
|
+
to install the development gem dependencies:
|
139
|
+
~~~sh
|
140
|
+
gem install bundler
|
141
|
+
bundle install
|
142
|
+
~~~
|
112
143
|
|
113
144
|
Once this is complete, you should be able to run the test suite:
|
114
|
-
|
115
|
-
|
145
|
+
~~~sh
|
146
|
+
rake
|
147
|
+
~~~
|
116
148
|
|
117
149
|
You'll get a warning that you need to install haml-spec, so run this:
|
118
150
|
|
119
|
-
|
151
|
+
~~~sh
|
152
|
+
git submodule update --init
|
153
|
+
~~~
|
120
154
|
|
121
155
|
At this point `rake` should run without error or warning and you are ready to
|
122
156
|
start working on your patch!
|
@@ -124,18 +158,20 @@ start working on your patch!
|
|
124
158
|
Note that you can also run just one test out of the test suite if you're working
|
125
159
|
on a specific area:
|
126
160
|
|
127
|
-
|
161
|
+
~~~sh
|
162
|
+
ruby -Itest test/helper_test.rb -n test_buffer_access
|
163
|
+
~~~
|
128
164
|
|
129
|
-
Haml supports Ruby
|
130
|
-
both 1.9 and 1.8.
|
165
|
+
Haml currently supports Ruby 2.0.0 and higher, so please make sure your changes run on 2.0+.
|
131
166
|
|
132
167
|
## Team
|
133
168
|
|
134
169
|
### Current Maintainers
|
135
170
|
|
136
|
-
* [Norman Clarke](http://github.com/norman)
|
137
|
-
* [Matt Wildig](http://github.com/mattwildig)
|
138
171
|
* [Akira Matsuda](https://github.com/amatsuda)
|
172
|
+
* [Matt Wildig](https://github.com/mattwildig)
|
173
|
+
* [Tee Parham](https://github.com/teeparham)
|
174
|
+
* [Takashi Kokubun](https://github.com/k0kubun)
|
139
175
|
|
140
176
|
### Alumni
|
141
177
|
|
@@ -143,17 +179,18 @@ Haml was created by [Hampton Catlin](http://hamptoncatlin.com), the author of
|
|
143
179
|
the original implementation. Hampton is no longer involved in day-to-day coding,
|
144
180
|
but still consults on language issues.
|
145
181
|
|
146
|
-
[
|
182
|
+
[Natalie Weizenbaum](http://nex-3.com) was for many years the primary developer
|
147
183
|
and architect of the "modern" Ruby implementation of Haml.
|
148
184
|
|
185
|
+
[Norman Clarke](http://github.com/norman) was the primary maintainer of Haml from 2012 to 2016.
|
149
186
|
|
150
187
|
## License
|
151
188
|
|
152
|
-
Some of
|
189
|
+
Some of Natalie's work on Haml was supported by Unspace Interactive.
|
153
190
|
|
154
191
|
Beyond that, the implementation is licensed under the MIT License.
|
155
192
|
|
156
|
-
Copyright (c) 2006-
|
193
|
+
Copyright (c) 2006-2019 Hampton Catlin, Natalie Weizenbaum and the Haml team
|
157
194
|
|
158
195
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
159
196
|
this software and associated documentation files (the "Software"), to deal in
|