haml 4.0.7 → 5.2.2

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.
Files changed (124) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yml +36 -0
  3. data/.gitignore +19 -0
  4. data/.gitmodules +3 -0
  5. data/.yardopts +2 -3
  6. data/CHANGELOG.md +146 -4
  7. data/FAQ.md +4 -14
  8. data/Gemfile +16 -0
  9. data/MIT-LICENSE +2 -2
  10. data/README.md +90 -47
  11. data/REFERENCE.md +160 -74
  12. data/Rakefile +44 -63
  13. data/TODO +24 -0
  14. data/benchmark.rb +70 -0
  15. data/haml.gemspec +45 -0
  16. data/lib/haml/.gitattributes +1 -0
  17. data/lib/haml/attribute_builder.rb +219 -0
  18. data/lib/haml/attribute_compiler.rb +237 -0
  19. data/lib/haml/attribute_parser.rb +150 -0
  20. data/lib/haml/buffer.rb +12 -175
  21. data/lib/haml/compiler.rb +110 -320
  22. data/lib/haml/engine.rb +34 -41
  23. data/lib/haml/error.rb +28 -24
  24. data/lib/haml/escapable.rb +77 -0
  25. data/lib/haml/exec.rb +38 -20
  26. data/lib/haml/filters.rb +22 -27
  27. data/lib/haml/generator.rb +42 -0
  28. data/lib/haml/helpers/action_view_extensions.rb +4 -2
  29. data/lib/haml/helpers/action_view_mods.rb +45 -60
  30. data/lib/haml/helpers/action_view_xss_mods.rb +2 -0
  31. data/lib/haml/helpers/safe_erubi_template.rb +20 -0
  32. data/lib/haml/helpers/safe_erubis_template.rb +5 -1
  33. data/lib/haml/helpers/xss_mods.rb +23 -13
  34. data/lib/haml/helpers.rb +134 -89
  35. data/lib/haml/options.rb +63 -69
  36. data/lib/haml/parser.rb +319 -227
  37. data/lib/haml/plugin.rb +54 -0
  38. data/lib/haml/railtie.rb +43 -12
  39. data/lib/haml/sass_rails_filter.rb +18 -4
  40. data/lib/haml/template/options.rb +13 -2
  41. data/lib/haml/template.rb +13 -6
  42. data/lib/haml/temple_engine.rb +124 -0
  43. data/lib/haml/temple_line_counter.rb +30 -0
  44. data/lib/haml/util.rb +83 -202
  45. data/lib/haml/version.rb +3 -1
  46. data/lib/haml.rb +2 -0
  47. data/yard/default/.gitignore +1 -0
  48. data/yard/default/fulldoc/html/css/common.sass +15 -0
  49. data/yard/default/layout/html/footer.erb +12 -0
  50. metadata +73 -115
  51. data/lib/haml/template/plugin.rb +0 -41
  52. data/test/engine_test.rb +0 -2013
  53. data/test/erb/_av_partial_1.erb +0 -12
  54. data/test/erb/_av_partial_2.erb +0 -8
  55. data/test/erb/action_view.erb +0 -62
  56. data/test/erb/standard.erb +0 -55
  57. data/test/filters_test.rb +0 -254
  58. data/test/gemfiles/Gemfile.rails-3.0.x +0 -5
  59. data/test/gemfiles/Gemfile.rails-3.1.x +0 -6
  60. data/test/gemfiles/Gemfile.rails-3.2.x +0 -5
  61. data/test/gemfiles/Gemfile.rails-4.0.x +0 -5
  62. data/test/haml-spec/LICENSE +0 -14
  63. data/test/haml-spec/README.md +0 -106
  64. data/test/haml-spec/lua_haml_spec.lua +0 -38
  65. data/test/haml-spec/perl_haml_test.pl +0 -81
  66. data/test/haml-spec/ruby_haml_test.rb +0 -23
  67. data/test/haml-spec/tests.json +0 -660
  68. data/test/helper_test.rb +0 -583
  69. data/test/markaby/standard.mab +0 -52
  70. data/test/mocks/article.rb +0 -6
  71. data/test/parser_test.rb +0 -105
  72. data/test/results/content_for_layout.xhtml +0 -12
  73. data/test/results/eval_suppressed.xhtml +0 -9
  74. data/test/results/helpers.xhtml +0 -70
  75. data/test/results/helpful.xhtml +0 -10
  76. data/test/results/just_stuff.xhtml +0 -70
  77. data/test/results/list.xhtml +0 -12
  78. data/test/results/nuke_inner_whitespace.xhtml +0 -40
  79. data/test/results/nuke_outer_whitespace.xhtml +0 -148
  80. data/test/results/original_engine.xhtml +0 -20
  81. data/test/results/partial_layout.xhtml +0 -5
  82. data/test/results/partial_layout_erb.xhtml +0 -5
  83. data/test/results/partials.xhtml +0 -21
  84. data/test/results/render_layout.xhtml +0 -3
  85. data/test/results/silent_script.xhtml +0 -74
  86. data/test/results/standard.xhtml +0 -162
  87. data/test/results/tag_parsing.xhtml +0 -23
  88. data/test/results/very_basic.xhtml +0 -5
  89. data/test/results/whitespace_handling.xhtml +0 -90
  90. data/test/template_test.rb +0 -354
  91. data/test/templates/_av_partial_1.haml +0 -9
  92. data/test/templates/_av_partial_1_ugly.haml +0 -9
  93. data/test/templates/_av_partial_2.haml +0 -5
  94. data/test/templates/_av_partial_2_ugly.haml +0 -5
  95. data/test/templates/_layout.erb +0 -3
  96. data/test/templates/_layout_for_partial.haml +0 -3
  97. data/test/templates/_partial.haml +0 -8
  98. data/test/templates/_text_area.haml +0 -3
  99. data/test/templates/_text_area_helper.html.haml +0 -4
  100. data/test/templates/action_view.haml +0 -47
  101. data/test/templates/action_view_ugly.haml +0 -47
  102. data/test/templates/breakage.haml +0 -8
  103. data/test/templates/content_for_layout.haml +0 -8
  104. data/test/templates/eval_suppressed.haml +0 -11
  105. data/test/templates/helpers.haml +0 -55
  106. data/test/templates/helpful.haml +0 -11
  107. data/test/templates/just_stuff.haml +0 -85
  108. data/test/templates/list.haml +0 -12
  109. data/test/templates/nuke_inner_whitespace.haml +0 -32
  110. data/test/templates/nuke_outer_whitespace.haml +0 -144
  111. data/test/templates/original_engine.haml +0 -17
  112. data/test/templates/partial_layout.haml +0 -3
  113. data/test/templates/partial_layout_erb.erb +0 -4
  114. data/test/templates/partialize.haml +0 -1
  115. data/test/templates/partials.haml +0 -12
  116. data/test/templates/render_layout.haml +0 -2
  117. data/test/templates/silent_script.haml +0 -45
  118. data/test/templates/standard.haml +0 -43
  119. data/test/templates/standard_ugly.haml +0 -43
  120. data/test/templates/tag_parsing.haml +0 -21
  121. data/test/templates/very_basic.haml +0 -4
  122. data/test/templates/whitespace_handling.haml +0 -87
  123. data/test/test_helper.rb +0 -81
  124. data/test/util_test.rb +0 -63
metadata CHANGED
@@ -1,17 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.7
4
+ version: 5.2.2
5
5
  platform: ruby
6
6
  authors:
7
- - Nathan Weizenbaum
7
+ - Natalie Weizenbaum
8
8
  - Hampton Catlin
9
9
  - Norman Clarke
10
- autorequire:
10
+ - Akira Matsuda
11
+ autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2015-08-10 00:00:00.000000000 Z
14
+ date: 2021-07-27 00:00:00.000000000 Z
14
15
  dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: temple
18
+ requirement: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.8.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.0
15
30
  - !ruby/object:Gem::Dependency
16
31
  name: tilt
17
32
  requirement: !ruby/object:Gem::Requirement
@@ -32,14 +47,14 @@ dependencies:
32
47
  requirements:
33
48
  - - ">="
34
49
  - !ruby/object:Gem::Version
35
- version: 3.0.0
50
+ version: 4.0.0
36
51
  type: :development
37
52
  prerelease: false
38
53
  version_requirements: !ruby/object:Gem::Requirement
39
54
  requirements:
40
55
  - - ">="
41
56
  - !ruby/object:Gem::Version
42
- version: 3.0.0
57
+ version: 4.0.0
43
58
  - !ruby/object:Gem::Dependency
44
59
  name: rbench
45
60
  requirement: !ruby/object:Gem::Requirement
@@ -56,6 +71,20 @@ dependencies:
56
71
  version: '0'
57
72
  - !ruby/object:Gem::Dependency
58
73
  name: minitest
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '4.0'
79
+ type: :development
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '4.0'
86
+ - !ruby/object:Gem::Dependency
87
+ name: nokogiri
59
88
  requirement: !ruby/object:Gem::Requirement
60
89
  requirements:
61
90
  - - ">="
@@ -69,19 +98,19 @@ dependencies:
69
98
  - !ruby/object:Gem::Version
70
99
  version: '0'
71
100
  - !ruby/object:Gem::Dependency
72
- name: nokogiri
101
+ name: simplecov
73
102
  requirement: !ruby/object:Gem::Requirement
74
103
  requirements:
75
- - - "~>"
104
+ - - ">="
76
105
  - !ruby/object:Gem::Version
77
- version: 1.5.10
106
+ version: '0'
78
107
  type: :development
79
108
  prerelease: false
80
109
  version_requirements: !ruby/object:Gem::Requirement
81
110
  requirements:
82
- - - "~>"
111
+ - - ">="
83
112
  - !ruby/object:Gem::Version
84
- version: 1.5.10
113
+ version: '0'
85
114
  description: |
86
115
  Haml (HTML Abstraction Markup Language) is a layer on top of HTML or XML that's
87
116
  designed to express the structure of documents in a non-repetitive, elegant, and
@@ -90,135 +119,72 @@ description: |
90
119
  but it can function as a stand-alone templating engine.
91
120
  email:
92
121
  - haml@googlegroups.com
93
- - norman@njclarke.com
122
+ - ronnie@dio.jp
94
123
  executables:
95
124
  - haml
96
125
  extensions: []
97
126
  extra_rdoc_files: []
98
127
  files:
128
+ - ".github/workflows/test.yml"
129
+ - ".gitignore"
130
+ - ".gitmodules"
99
131
  - ".yardopts"
100
132
  - CHANGELOG.md
101
133
  - FAQ.md
134
+ - Gemfile
102
135
  - MIT-LICENSE
103
136
  - README.md
104
137
  - REFERENCE.md
105
138
  - Rakefile
139
+ - TODO
140
+ - benchmark.rb
106
141
  - bin/haml
142
+ - haml.gemspec
107
143
  - lib/haml.rb
144
+ - lib/haml/.gitattributes
145
+ - lib/haml/attribute_builder.rb
146
+ - lib/haml/attribute_compiler.rb
147
+ - lib/haml/attribute_parser.rb
108
148
  - lib/haml/buffer.rb
109
149
  - lib/haml/compiler.rb
110
150
  - lib/haml/engine.rb
111
151
  - lib/haml/error.rb
152
+ - lib/haml/escapable.rb
112
153
  - lib/haml/exec.rb
113
154
  - lib/haml/filters.rb
155
+ - lib/haml/generator.rb
114
156
  - lib/haml/helpers.rb
115
157
  - lib/haml/helpers/action_view_extensions.rb
116
158
  - lib/haml/helpers/action_view_mods.rb
117
159
  - lib/haml/helpers/action_view_xss_mods.rb
160
+ - lib/haml/helpers/safe_erubi_template.rb
118
161
  - lib/haml/helpers/safe_erubis_template.rb
119
162
  - lib/haml/helpers/xss_mods.rb
120
163
  - lib/haml/options.rb
121
164
  - lib/haml/parser.rb
165
+ - lib/haml/plugin.rb
122
166
  - lib/haml/railtie.rb
123
167
  - lib/haml/sass_rails_filter.rb
124
168
  - lib/haml/template.rb
125
169
  - lib/haml/template/options.rb
126
- - lib/haml/template/plugin.rb
170
+ - lib/haml/temple_engine.rb
171
+ - lib/haml/temple_line_counter.rb
127
172
  - lib/haml/util.rb
128
173
  - lib/haml/version.rb
129
- - test/engine_test.rb
130
- - test/erb/_av_partial_1.erb
131
- - test/erb/_av_partial_2.erb
132
- - test/erb/action_view.erb
133
- - test/erb/standard.erb
134
- - test/filters_test.rb
135
- - test/gemfiles/Gemfile.rails-3.0.x
136
- - test/gemfiles/Gemfile.rails-3.1.x
137
- - test/gemfiles/Gemfile.rails-3.2.x
138
- - test/gemfiles/Gemfile.rails-4.0.x
139
- - test/haml-spec/LICENSE
140
- - test/haml-spec/README.md
141
- - test/haml-spec/lua_haml_spec.lua
142
- - test/haml-spec/perl_haml_test.pl
143
- - test/haml-spec/ruby_haml_test.rb
144
- - test/haml-spec/tests.json
145
- - test/helper_test.rb
146
- - test/markaby/standard.mab
147
- - test/mocks/article.rb
148
- - test/parser_test.rb
149
- - test/results/content_for_layout.xhtml
150
- - test/results/eval_suppressed.xhtml
151
- - test/results/helpers.xhtml
152
- - test/results/helpful.xhtml
153
- - test/results/just_stuff.xhtml
154
- - test/results/list.xhtml
155
- - test/results/nuke_inner_whitespace.xhtml
156
- - test/results/nuke_outer_whitespace.xhtml
157
- - test/results/original_engine.xhtml
158
- - test/results/partial_layout.xhtml
159
- - test/results/partial_layout_erb.xhtml
160
- - test/results/partials.xhtml
161
- - test/results/render_layout.xhtml
162
- - test/results/silent_script.xhtml
163
- - test/results/standard.xhtml
164
- - test/results/tag_parsing.xhtml
165
- - test/results/very_basic.xhtml
166
- - test/results/whitespace_handling.xhtml
167
- - test/template_test.rb
168
- - test/templates/_av_partial_1.haml
169
- - test/templates/_av_partial_1_ugly.haml
170
- - test/templates/_av_partial_2.haml
171
- - test/templates/_av_partial_2_ugly.haml
172
- - test/templates/_layout.erb
173
- - test/templates/_layout_for_partial.haml
174
- - test/templates/_partial.haml
175
- - test/templates/_text_area.haml
176
- - test/templates/_text_area_helper.html.haml
177
- - test/templates/action_view.haml
178
- - test/templates/action_view_ugly.haml
179
- - test/templates/breakage.haml
180
- - test/templates/content_for_layout.haml
181
- - test/templates/eval_suppressed.haml
182
- - test/templates/helpers.haml
183
- - test/templates/helpful.haml
184
- - test/templates/just_stuff.haml
185
- - test/templates/list.haml
186
- - test/templates/nuke_inner_whitespace.haml
187
- - test/templates/nuke_outer_whitespace.haml
188
- - test/templates/original_engine.haml
189
- - test/templates/partial_layout.haml
190
- - test/templates/partial_layout_erb.erb
191
- - test/templates/partialize.haml
192
- - test/templates/partials.haml
193
- - test/templates/render_layout.haml
194
- - test/templates/silent_script.haml
195
- - test/templates/standard.haml
196
- - test/templates/standard_ugly.haml
197
- - test/templates/tag_parsing.haml
198
- - test/templates/very_basic.haml
199
- - test/templates/whitespace_handling.haml
200
- - test/test_helper.rb
201
- - test/util_test.rb
174
+ - yard/default/.gitignore
175
+ - yard/default/fulldoc/html/css/common.sass
176
+ - yard/default/layout/html/footer.erb
202
177
  homepage: http://haml.info/
203
178
  licenses:
204
179
  - MIT
205
- metadata: {}
206
- post_install_message: |2+
207
-
208
- HEADS UP! Haml 4.0 has many improvements, but also has changes that may break
209
- your application:
210
-
211
- * Support for Ruby 1.8.6 dropped
212
- * Support for Rails 2 dropped
213
- * Sass filter now always outputs <style> tags
214
- * Data attributes are now hyphenated, not underscored
215
- * html2haml utility moved to the html2haml gem
216
- * Textile and Maruku filters moved to the haml-contrib gem
217
-
218
- For more info see:
219
-
220
- http://rubydoc.info/github/haml/haml/file/CHANGELOG.md
221
-
180
+ metadata:
181
+ bug_tracker_uri: https://github.com/haml/haml/issues
182
+ changelog_uri: https://github.com/haml/haml/blob/main/CHANGELOG.md
183
+ documentation_uri: http://haml.info/docs.html
184
+ homepage_uri: http://haml.info
185
+ mailing_list_uri: https://groups.google.com/forum/?fromgroups#!forum/haml
186
+ source_code_uri: https://github.com/haml/haml
187
+ post_install_message:
222
188
  rdoc_options: []
223
189
  require_paths:
224
190
  - lib
@@ -226,23 +192,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
226
192
  requirements:
227
193
  - - ">="
228
194
  - !ruby/object:Gem::Version
229
- version: '0'
195
+ version: 2.0.0
230
196
  required_rubygems_version: !ruby/object:Gem::Requirement
231
197
  requirements:
232
198
  - - ">="
233
199
  - !ruby/object:Gem::Version
234
200
  version: '0'
235
201
  requirements: []
236
- rubyforge_project:
237
- rubygems_version: 2.4.7
238
- signing_key:
202
+ rubygems_version: 3.1.4
203
+ signing_key:
239
204
  specification_version: 4
240
205
  summary: An elegant, structured (X)HTML/XML templating engine.
241
- test_files:
242
- - test/engine_test.rb
243
- - test/filters_test.rb
244
- - test/haml-spec/ruby_haml_test.rb
245
- - test/helper_test.rb
246
- - test/parser_test.rb
247
- - test/template_test.rb
248
- - test/util_test.rb
206
+ test_files: []
@@ -1,41 +0,0 @@
1
- module Haml
2
-
3
- # This module makes Haml work with Rails using the template handler API.
4
- class Plugin < ActionView::Template::Handlers::ERB.superclass
5
-
6
- # Rails 3.1+, template handlers don't inherit from anything. In <= 3.0, they
7
- # do. To avoid messy logic figuring this out, we just inherit from whatever
8
- # the ERB handler does.
9
-
10
- # In Rails 3.1+, we don't need to include Compilable.
11
- if (ActionPack::VERSION::MAJOR == 3) && (ActionPack::VERSION::MINOR < 1)
12
- include ActionView::Template::Handlers::Compilable
13
- end
14
-
15
- def handles_encoding?; true; end
16
-
17
- def compile(template)
18
- options = Haml::Template.options.dup
19
- if (ActionPack::VERSION::MAJOR >= 4) && template.respond_to?(:type)
20
- options[:mime_type] = template.type
21
- elsif template.respond_to? :mime_type
22
- options[:mime_type] = template.mime_type
23
- end
24
- options[:filename] = template.identifier
25
- Haml::Engine.new(template.source, options).compiler.precompiled_with_ambles([])
26
- end
27
-
28
- # In Rails 3.1+, #call takes the place of #compile
29
- def self.call(template)
30
- new.compile(template)
31
- end
32
-
33
- def cache_fragment(block, name = {}, options = nil)
34
- @view.fragment_for(block, name, options) do
35
- eval("_hamlout.buffer", block.binding)
36
- end
37
- end
38
- end
39
- end
40
-
41
- ActionView::Template.register_template_handler(:haml, Haml::Plugin)