haml 4.0.7 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/CHANGELOG.md +42 -4
  4. data/FAQ.md +4 -14
  5. data/MIT-LICENSE +1 -1
  6. data/README.md +85 -42
  7. data/REFERENCE.md +108 -57
  8. data/Rakefile +46 -54
  9. data/lib/haml/attribute_builder.rb +163 -0
  10. data/lib/haml/attribute_compiler.rb +215 -0
  11. data/lib/haml/attribute_parser.rb +144 -0
  12. data/lib/haml/buffer.rb +22 -132
  13. data/lib/haml/compiler.rb +87 -295
  14. data/lib/haml/engine.rb +25 -41
  15. data/lib/haml/error.rb +3 -0
  16. data/lib/haml/escapable.rb +49 -0
  17. data/lib/haml/exec.rb +33 -19
  18. data/lib/haml/filters.rb +18 -24
  19. data/lib/haml/generator.rb +41 -0
  20. data/lib/haml/helpers/action_view_extensions.rb +3 -2
  21. data/lib/haml/helpers/action_view_mods.rb +36 -58
  22. data/lib/haml/helpers/action_view_xss_mods.rb +1 -0
  23. data/lib/haml/helpers/safe_erubi_template.rb +27 -0
  24. data/lib/haml/helpers/safe_erubis_template.rb +4 -1
  25. data/lib/haml/helpers/xss_mods.rb +18 -12
  26. data/lib/haml/helpers.rb +133 -90
  27. data/lib/haml/options.rb +38 -47
  28. data/lib/haml/parser.rb +278 -216
  29. data/lib/haml/{template/plugin.rb → plugin.rb} +8 -15
  30. data/lib/haml/railtie.rb +21 -12
  31. data/lib/haml/sass_rails_filter.rb +17 -4
  32. data/lib/haml/template/options.rb +12 -2
  33. data/lib/haml/template.rb +12 -6
  34. data/lib/haml/temple_engine.rb +120 -0
  35. data/lib/haml/temple_line_counter.rb +29 -0
  36. data/lib/haml/util.rb +80 -199
  37. data/lib/haml/version.rb +2 -1
  38. data/lib/haml.rb +1 -0
  39. data/test/attribute_parser_test.rb +101 -0
  40. data/test/engine_test.rb +287 -176
  41. data/test/filters_test.rb +32 -19
  42. data/test/gemfiles/Gemfile.rails-4.0.x +9 -3
  43. data/test/gemfiles/Gemfile.rails-4.0.x.lock +87 -0
  44. data/test/gemfiles/Gemfile.rails-4.1.x +5 -0
  45. data/test/gemfiles/Gemfile.rails-4.2.x +5 -0
  46. data/test/gemfiles/Gemfile.rails-5.0.x +4 -0
  47. data/test/helper_test.rb +224 -112
  48. data/test/options_test.rb +22 -0
  49. data/test/parser_test.rb +71 -4
  50. data/test/results/bemit.xhtml +4 -0
  51. data/test/results/eval_suppressed.xhtml +4 -4
  52. data/test/results/helpers.xhtml +43 -41
  53. data/test/results/helpful.xhtml +6 -3
  54. data/test/results/just_stuff.xhtml +21 -20
  55. data/test/results/list.xhtml +9 -9
  56. data/test/results/nuke_inner_whitespace.xhtml +22 -22
  57. data/test/results/nuke_outer_whitespace.xhtml +84 -92
  58. data/test/results/original_engine.xhtml +17 -17
  59. data/test/results/partial_layout.xhtml +4 -3
  60. data/test/results/partial_layout_erb.xhtml +4 -3
  61. data/test/results/partials.xhtml +11 -10
  62. data/test/results/silent_script.xhtml +63 -63
  63. data/test/results/standard.xhtml +156 -159
  64. data/test/results/tag_parsing.xhtml +19 -19
  65. data/test/results/very_basic.xhtml +2 -2
  66. data/test/results/whitespace_handling.xhtml +77 -76
  67. data/test/template_test.rb +24 -56
  68. data/test/template_test_helper.rb +38 -0
  69. data/test/templates/bemit.haml +3 -0
  70. data/test/templates/just_stuff.haml +1 -0
  71. data/test/templates/standard_ugly.haml +1 -0
  72. data/test/templates/with_bom.haml +1 -0
  73. data/test/temple_line_counter_test.rb +40 -0
  74. data/test/test_helper.rb +26 -8
  75. data/test/util_test.rb +6 -47
  76. metadata +53 -43
  77. data/test/gemfiles/Gemfile.rails-3.0.x +0 -5
  78. data/test/gemfiles/Gemfile.rails-3.1.x +0 -6
  79. data/test/gemfiles/Gemfile.rails-3.2.x +0 -5
  80. data/test/haml-spec/LICENSE +0 -14
  81. data/test/haml-spec/README.md +0 -106
  82. data/test/haml-spec/lua_haml_spec.lua +0 -38
  83. data/test/haml-spec/perl_haml_test.pl +0 -81
  84. data/test/haml-spec/ruby_haml_test.rb +0 -23
  85. data/test/haml-spec/tests.json +0 -660
  86. data/test/templates/_av_partial_1_ugly.haml +0 -9
  87. data/test/templates/_av_partial_2_ugly.haml +0 -5
  88. data/test/templates/action_view_ugly.haml +0 -47
  89. data/test/templates/standard_ugly.haml +0 -43
@@ -1,47 +0,0 @@
1
- !!!
2
- %html{html_attrs}
3
- %head
4
- %title Hampton Catlin Is Totally Awesome
5
- %meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}
6
- %body
7
- %h1
8
- This is very much like the standard template,
9
- except that it has some ActionView-specific stuff.
10
- It's only used for benchmarking.
11
- .crazy_partials= render :partial => 'templates/av_partial_1_ugly'
12
- / You're In my house now!
13
- .header
14
- Yes, ladies and gentileman. He is just that egotistical.
15
- Fantastic! This should be multi-line output
16
- The question is if this would translate! Ahah!
17
- = 1 + 9 + 8 + 2 #numbers should work and this should be ignored
18
- #body= " Quotes should be loved! Just like people!"
19
- - 120.times do |number|
20
- - number
21
- Wow.|
22
- %p
23
- = "Holy cow " + |
24
- "multiline " + |
25
- "tags! " + |
26
- "A pipe (|) even!" |
27
- = [1, 2, 3].collect { |n| "PipesIgnored|" }
28
- = [1, 2, 3].collect { |n| |
29
- n.to_s |
30
- }.join("|") |
31
- %div.silent
32
- - foo = String.new
33
- - foo << "this"
34
- - foo << " shouldn't"
35
- - foo << " evaluate"
36
- = foo + " but now it should!"
37
- -# Woah crap a comment!
38
-
39
- -# That was a line that shouldn't close everything.
40
- %ul.really.cool
41
- - ('a'..'f').each do |a|
42
- %li= a
43
- #combo.of_divs_with_underscore= @should_eval = "with this text"
44
- = [ 104, 101, 108, 108, 111 ].map do |byte|
45
- - byte.chr
46
- .footer
47
- %strong.shout= "This is a really long ruby quote. It should be loved and wrapped because its more than 50 characters. This value may change in the future and this test may look stupid. \nSo, I'm just making it *really* long. God, I hope this works"
@@ -1,43 +0,0 @@
1
- !!!
2
- %html{:xmlns => "http://www.w3.org/1999/xhtml", "xml:lang" => "en-US", "lang" => "en-US"}
3
- %head
4
- %title Hampton Catlin Is Totally Awesome
5
- %meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}
6
- %body
7
- / You're In my house now!
8
- .header
9
- Yes, ladies and gentileman. He is just that egotistical.
10
- Fantastic! This should be multi-line output
11
- The question is if this would translate! Ahah!
12
- = 1 + 9 + 8 + 2 #numbers should work and this should be ignored
13
- #body= " Quotes should be loved! Just like people!"
14
- - 120.times do |number|
15
- = number
16
- Wow.|
17
- %p{:code => 1 + 2}
18
- = "Holy cow " + |
19
- "multiline " + |
20
- "tags! " + |
21
- "A pipe (|) even!" |
22
- = [1, 2, 3].collect { |n| "PipesIgnored|" }.join
23
- = [1, 2, 3].collect { |n| |
24
- n.to_s |
25
- }.join("|") |
26
- - bar = 17
27
- %div.silent{:foo => bar}
28
- - foo = String.new
29
- - foo << "this"
30
- - foo << " shouldn't"
31
- - foo << " evaluate"
32
- = foo + " but now it should!"
33
- -# Woah crap a comment!
34
-
35
- -# That was a line that shouldn't close everything.
36
- %ul.really.cool
37
- - ('a'..'f').each do |a|
38
- %li= a
39
- #combo.of_divs_with_underscore= @should_eval = "with this text"
40
- = "foo".each_line do |line|
41
- - nil
42
- .footer
43
- %strong.shout= "This is a really long ruby quote. It should be loved and wrapped because its more than 50 characters. This value may change in the future and this test may look stupid. \nSo, I'm just making it *really* long. God, I hope this works"