haml 1.0.5 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of haml might be problematic. Click here for more details.

Files changed (92) hide show
  1. data/README +229 -0
  2. data/Rakefile +56 -60
  3. data/VERSION +1 -1
  4. data/bin/haml +4 -14
  5. data/bin/html2haml +89 -0
  6. data/bin/sass +8 -0
  7. data/init.rb +5 -1
  8. data/lib/haml.rb +643 -0
  9. data/lib/haml/buffer.rb +33 -30
  10. data/lib/haml/engine.rb +258 -75
  11. data/lib/haml/error.rb +43 -0
  12. data/lib/haml/exec.rb +181 -0
  13. data/lib/haml/filters.rb +89 -0
  14. data/lib/haml/helpers.rb +19 -5
  15. data/lib/haml/helpers/action_view_mods.rb +28 -4
  16. data/lib/haml/template.rb +13 -27
  17. data/lib/sass.rb +418 -0
  18. data/lib/sass/constant.rb +190 -0
  19. data/lib/sass/constant/color.rb +77 -0
  20. data/lib/sass/constant/literal.rb +51 -0
  21. data/lib/sass/constant/number.rb +87 -0
  22. data/lib/sass/constant/operation.rb +30 -0
  23. data/lib/sass/constant/string.rb +18 -0
  24. data/lib/sass/engine.rb +179 -0
  25. data/lib/sass/error.rb +35 -0
  26. data/lib/sass/plugin.rb +119 -0
  27. data/lib/sass/tree/attr_node.rb +44 -0
  28. data/lib/sass/tree/node.rb +29 -0
  29. data/lib/sass/tree/rule_node.rb +47 -0
  30. data/lib/sass/tree/value_node.rb +12 -0
  31. data/test/benchmark.rb +16 -19
  32. data/test/haml/engine_test.rb +220 -0
  33. data/test/{helper_test.rb → haml/helper_test.rb} +9 -8
  34. data/test/{mocks → haml/mocks}/article.rb +0 -0
  35. data/test/{results → haml/results}/content_for_layout.xhtml +0 -0
  36. data/test/{results → haml/results}/eval_suppressed.xhtml +0 -0
  37. data/test/haml/results/filters.xhtml +57 -0
  38. data/test/{results → haml/results}/helpers.xhtml +10 -0
  39. data/test/haml/results/helpful.xhtml +8 -0
  40. data/test/{results → haml/results}/just_stuff.xhtml +5 -0
  41. data/test/{results → haml/results}/list.xhtml +0 -0
  42. data/test/{results → haml/results}/original_engine.xhtml +1 -1
  43. data/test/{results → haml/results}/partials.xhtml +0 -0
  44. data/test/{results → haml/results}/silent_script.xhtml +0 -0
  45. data/test/{results → haml/results}/standard.xhtml +2 -1
  46. data/test/{results → haml/results}/tag_parsing.xhtml +0 -0
  47. data/test/{results → haml/results}/very_basic.xhtml +0 -0
  48. data/test/haml/results/whitespace_handling.xhtml +104 -0
  49. data/test/{rhtml → haml/rhtml}/standard.rhtml +4 -1
  50. data/test/{runner.rb → haml/runner.rb} +1 -1
  51. data/test/{template_test.rb → haml/template_test.rb} +28 -23
  52. data/test/{templates → haml/templates}/_partial.haml +0 -0
  53. data/test/{templates → haml/templates}/_text_area.haml +0 -0
  54. data/test/haml/templates/breakage.haml +8 -0
  55. data/test/{templates → haml/templates}/content_for_layout.haml +0 -0
  56. data/test/{templates → haml/templates}/eval_suppressed.haml +0 -0
  57. data/test/haml/templates/filters.haml +53 -0
  58. data/test/{templates → haml/templates}/helpers.haml +10 -1
  59. data/test/{templates → haml/templates}/helpful.haml +3 -0
  60. data/test/{templates → haml/templates}/just_stuff.haml +7 -0
  61. data/test/{templates → haml/templates}/list.haml +0 -0
  62. data/test/haml/templates/original_engine.haml +17 -0
  63. data/test/{templates → haml/templates}/partialize.haml +0 -0
  64. data/test/{templates → haml/templates}/partials.haml +0 -0
  65. data/test/{templates → haml/templates}/silent_script.haml +0 -0
  66. data/test/{templates → haml/templates}/standard.haml +3 -1
  67. data/test/{templates → haml/templates}/tag_parsing.haml +0 -0
  68. data/test/{templates → haml/templates}/very_basic.haml +0 -0
  69. data/test/haml/templates/whitespace_handling.haml +137 -0
  70. data/test/profile.rb +36 -18
  71. data/test/sass/engine_test.rb +87 -0
  72. data/test/sass/plugin_test.rb +103 -0
  73. data/test/sass/results/basic.css +9 -0
  74. data/test/sass/results/compact.css +5 -0
  75. data/test/sass/results/complex.css +86 -0
  76. data/test/sass/results/constants.css +12 -0
  77. data/test/sass/results/expanded.css +18 -0
  78. data/test/sass/results/nested.css +14 -0
  79. data/test/sass/templates/basic.sass +23 -0
  80. data/test/sass/templates/bork.sass +2 -0
  81. data/test/sass/templates/compact.sass +15 -0
  82. data/test/sass/templates/complex.sass +291 -0
  83. data/test/sass/templates/constants.sass +80 -0
  84. data/test/sass/templates/expanded.sass +15 -0
  85. data/test/sass/templates/nested.sass +15 -0
  86. metadata +98 -48
  87. data/REFERENCE +0 -662
  88. data/test/engine_test.rb +0 -93
  89. data/test/results/helpful.xhtml +0 -5
  90. data/test/results/whitespace_handling.xhtml +0 -51
  91. data/test/templates/original_engine.haml +0 -17
  92. data/test/templates/whitespace_handling.haml +0 -66
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'test/unit'
4
- require File.dirname(__FILE__) + '/../lib/haml/template'
4
+ require File.dirname(__FILE__) + '/../../lib/haml'
5
+ require 'haml/template'
5
6
 
6
7
  class HelperTest < Test::Unit::TestCase
7
8
  include Haml::Helpers
@@ -81,7 +82,7 @@ class HelperTest < Test::Unit::TestCase
81
82
  end
82
83
  end
83
84
 
84
- load File.dirname(__FILE__) + '/../lib/haml/helpers/action_view_mods.rb'
85
+ load File.dirname(__FILE__) + '/../../lib/haml/helpers/action_view_mods.rb'
85
86
 
86
87
  Kernel.module_eval do
87
88
  alias_method :require, :old_require
@@ -89,17 +90,17 @@ class HelperTest < Test::Unit::TestCase
89
90
  end
90
91
 
91
92
  def test_form_tag
92
- # Until the next Rails is released, form_tag with a block can have one of
93
- # two behaviors.
94
-
95
93
  result = render("- form_tag 'foo' do\n %p bar\n %strong baz", :action_view)
96
- new_rails = "<form action=\"foo\" method=\"post\">\n <p>bar</p>\n <strong>baz</strong>\n</form>"
97
- old_rails = ""
98
- assert(result == new_rails || result == old_rails)
94
+ should_be = "<form action=\"foo\" method=\"post\">\n <p>bar</p>\n <strong>baz</strong>\n</form>\n"
95
+ assert_equal(should_be, result)
99
96
  end
100
97
 
101
98
  def test_capture_haml
102
99
  assert_equal("\"<p>13</p>\\n\"\n", render("- foo = capture_haml(13) do |a|\n %p= a\n= foo.dump"))
103
100
  end
101
+
102
+ def test_is_haml
103
+ assert(!ActionView::Base.new.is_haml?)
104
+ end
104
105
  end
105
106
 
File without changes
@@ -0,0 +1,57 @@
1
+ <style>
2
+ p {
3
+ border-style: dotted;
4
+ border-width: 10px;
5
+ border-color: #ff00ff; }
6
+
7
+ h1 {
8
+ font-weight: normal; }
9
+ </style>
10
+ TESTING HAHAHAHA!
11
+ <h1>Foo</h1>
12
+
13
+
14
+ <pre><code>This is preformatted!
15
+ Look at that!
16
+ Wowie-zowie!</code></pre>
17
+
18
+
19
+ <p><strong>boldilicious!</strong></p>
20
+ <h1>Yeah</h1>
21
+
22
+
23
+ <p><em>pretty much the same as above</em></p>
24
+ This
25
+ Is
26
+ Plain
27
+ Text
28
+ %strong right?
29
+
30
+ a
31
+
32
+ b
33
+
34
+ c
35
+
36
+ d
37
+
38
+ e
39
+
40
+ f
41
+
42
+ g
43
+
44
+ h
45
+
46
+ i
47
+
48
+ j
49
+ <ul>
50
+ <li>Foo</li>
51
+ <li>Bar</li>
52
+ <li>BAZ!</li>
53
+ </ul>
54
+ Text!
55
+ Hello, World!
56
+ How are you doing today?
57
+
@@ -47,4 +47,14 @@ click
47
47
  <p>baz</p>
48
48
  <p>boom</p>
49
49
  foo
50
+ <form action="hello/world" method="post">
51
+ <form action="heeheeaform" method="post">
52
+ <div><input name="commit" type="submit" value="save" /></div>
53
+ </form>
54
+ <form action="article_url" method="post">
55
+ Title:
56
+ <input id="article_title" name="article[title]" size="30" type="text" value="Hello" />
57
+ Body:
58
+ <input id="article_body" name="article[body]" size="30" type="text" value="World" />
59
+ </form>
50
60
  <li><a href='http://www.google.com'>google</a></li>
@@ -0,0 +1,8 @@
1
+ <div class='article' id='article_1'>
2
+ <h1>Hello</h1>
3
+ <div>World</div>
4
+ </div>
5
+ <div class='article' id='id_article_1'>id</div>
6
+ <div class='article class' id='article_1'>class</div>
7
+ <div class='article class' id='id_article_1'>id class</div>
8
+ <div class='article full' id='article_1'>boo</div>
@@ -7,6 +7,9 @@
7
7
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
8
8
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
9
9
  <strong apos="Foo's bar!">Boo!</strong>
10
+ Embedded? false!
11
+ Embedded? true!
12
+ Embedded? true!
10
13
  <div class='render'><em>wow!</em></div>
11
14
  stuff followed by whitespace
12
15
  <strong>block with whitespace</strong>
@@ -26,6 +29,7 @@ stuff followed by whitespace
26
29
  <strong>there can even be sub-tags!</strong>
27
30
  Or script!
28
31
  -->
32
+ <p>class attribute shouldn't appear!</p>
29
33
  <!--[if lte IE6]> conditional comment! <![endif]-->
30
34
  <!--[if gte IE7]>
31
35
  <p>Block conditional comment</p>
@@ -36,3 +40,4 @@ stuff followed by whitespace
36
40
  <!--[if gte IE5.2]>
37
41
  Woah a period.
38
42
  <![endif]-->
43
+ testtest
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
2
  <html>
3
3
  <head>
4
- <title>Stop. HAML time</title>
4
+ <title>Stop. haml time</title>
5
5
  <div id='content'>
6
6
  <h1>This is a title!</h1>
7
7
  <p>
@@ -6,7 +6,8 @@
6
6
  </head>
7
7
  <body>
8
8
  <!-- You're In my house now! -->
9
- Foo <div class='header'>
9
+ foo
10
+ <div class='header'>
10
11
  Yes, ladies and gentileman. He is just that egotistical.
11
12
  Fantastic! This should be multi-line output
12
13
  The question is if this would translate! Ahah!
@@ -0,0 +1,104 @@
1
+ <div id='whitespace_test'>
2
+ <div class='text_area_test_area'>
3
+ <textarea>Oneline</textarea>
4
+ </div>
5
+ <textarea>BLAH
6
+ </textarea>
7
+ <div class='text_area_test_area'>
8
+ <textarea>Two&#x000A;lines</textarea>
9
+ </div>
10
+ <textarea>BLAH
11
+ </textarea>
12
+ <div class='text_area_test_area'>
13
+ <textarea>Oneline</textarea>
14
+ </div>
15
+ <textarea>BLAH&#x000A;</textarea>
16
+ <div class='text_area_test_area'>
17
+ <textarea>Two&#x000A;lines</textarea>
18
+ </div>
19
+ <textarea>BLAH&#x000A;</textarea>
20
+ <div id='flattened'>
21
+ <div class='text_area_test_area'>
22
+ <textarea>Two&#x000A;lines</textarea>
23
+ </div>
24
+ <textarea>BLAH&#x000A;</textarea>
25
+ </div>
26
+ </div>
27
+ <div class='hithere'>
28
+ Foo bar
29
+ <pre>foo bar</pre>
30
+ <pre>foo&#x000A;bar</pre>
31
+ <p><pre>foo&#x000A;bar</pre></p>
32
+ <p>
33
+ foo
34
+ bar
35
+ </p>
36
+ <pre>&#x000A; ___&#x000A; ,o88888&#x000A; ,o8888888'&#x000A; ,:o:o:oooo. ,8O88Pd8888"&#x000A; ,.::.::o:ooooOoOoO. ,oO8O8Pd888'"&#x000A; ,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O"&#x000A; , ..:.::o:ooOoOOOO8OOOOo.FdO8O8"&#x000A; , ..:.::o:ooOoOO8O888O8O,COCOO"&#x000A; , . ..:.::o:ooOoOOOO8OOOOCOCO"&#x000A; . ..:.::o:ooOoOoOO8O8OCCCC"o&#x000A; . ..:.::o:ooooOoCoCCC"o:o&#x000A; . ..:.::o:o:,cooooCo"oo:o:&#x000A; ` . . ..:.:cocoooo"'o:o:::'&#x000A; .` . ..::ccccoc"'o:o:o:::'&#x000A; :.:. ,c:cccc"':.:.:.:.:.'&#x000A; ..:.:"'`::::c:"'..:.:.:.:.:.' http://www.chris.com/ASCII/&#x000A; ...:.'.:.::::"' . . . . .'&#x000A; .. . ....:."' ` . . . ''&#x000A; . . . ...."'&#x000A; .. . ."' -hrr-&#x000A; .&#x000A;&#x000A;&#x000A; It's a planet!&#x000A;%strong This shouldn't be bold!&#x000A;</pre>
37
+ <strong>This should!</strong>
38
+ <textarea>
39
+ ___ ___ ___ ___ &#x000A; /\__\ /\ \ /\__\ /\__\&#x000A; /:/ / /::\ \ /::| | /:/ /&#x000A; /:/__/ /:/\:\ \ /:|:| | /:/ / &#x000A; /::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ / &#x000A; /:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/ &#x000A; \/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \ &#x000A; \::/ / \::/ / /:/ / \:\ \ &#x000A; /:/ / /:/ / /:/ / \:\ \ &#x000A; /:/ / /:/ / /:/ / \:\__\&#x000A; \/__/ \/__/ \/__/ \/__/&#x000A;&#x000A; Many&#x000A; thanks&#x000A; to&#x000A; http://www.network-science.de/ascii/&#x000A;
40
+ <strong>indeed!</strong>
41
+ </textarea>
42
+ </div>
43
+ <div class='foo'>
44
+ 13
45
+ <textarea>&#x000A;a&#x000A;</textarea><textarea>&#x000A;b&#x000A;</textarea><textarea>&#x000A;c&#x000A;</textarea>
46
+ </div>
47
+ <pre>
48
+ foo&#x000A;
49
+ bar
50
+ </pre>
51
+ <div id='whitespace_test'>
52
+ <div class='text_area_test_area'>
53
+ <textarea>Oneline</textarea>
54
+ </div>
55
+ <textarea>BLAH
56
+ </textarea>
57
+ <div class='text_area_test_area'>
58
+ <textarea>Two&#x000A;lines</textarea>
59
+ </div>
60
+ <textarea>BLAH
61
+ </textarea>
62
+ <div class='text_area_test_area'>
63
+ <textarea>Oneline</textarea>
64
+ </div>
65
+ <textarea>BLAH&#x000A;</textarea>
66
+ <div class='text_area_test_area'>
67
+ <textarea>Two&#x000A;lines</textarea>
68
+ </div>
69
+ <textarea>BLAH&#x000A;</textarea>
70
+ <div id='flattened'>
71
+ <div class='text_area_test_area'>
72
+ <textarea>Two&#x000A;lines</textarea>
73
+ </div>
74
+ <textarea>BLAH&#x000A;</textarea>
75
+ </div>
76
+ </div>
77
+ <div class='hithere'>
78
+ Foo bar
79
+ <pre>foo bar</pre>
80
+ <pre>foo&#x000A;bar</pre>
81
+ <p><pre>foo&#x000A;bar</pre></p>
82
+ <p>
83
+ foo
84
+ bar
85
+ </p>
86
+ <pre>
87
+ ___&#x000A; ,o88888&#x000A; ,o8888888'&#x000A; ,:o:o:oooo. ,8O88Pd8888"&#x000A; ,.::.::o:ooooOoOoO. ,oO8O8Pd888'"&#x000A; ,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O"&#x000A; , ..:.::o:ooOoOOOO8OOOOo.FdO8O8"&#x000A; , ..:.::o:ooOoOO8O888O8O,COCOO"&#x000A; , . ..:.::o:ooOoOOOO8OOOOCOCO"&#x000A; . ..:.::o:ooOoOoOO8O8OCCCC"o&#x000A; . ..:.::o:ooooOoCoCCC"o:o&#x000A; . ..:.::o:o:,cooooCo"oo:o:&#x000A; ` . . ..:.:cocoooo"'o:o:::'&#x000A; .` . ..::ccccoc"'o:o:o:::'&#x000A; :.:. ,c:cccc"':.:.:.:.:.'&#x000A; ..:.:"'`::::c:"'..:.:.:.:.:.' http://www.chris.com/ASCII/&#x000A; ...:.'.:.::::"' . . . . .'&#x000A; .. . ....:."' ` . . . ''&#x000A; . . . ...."'&#x000A; .. . ."' -hrr-&#x000A; .&#x000A;&#x000A;&#x000A; It's a planet!&#x000A;%strong This shouldn't be bold!&#x000A;
88
+ </pre>
89
+ <strong>This should!</strong>
90
+ <textarea>
91
+ ___ ___ ___ ___ &#x000A; /\__\ /\ \ /\__\ /\__\&#x000A; /:/ / /::\ \ /::| | /:/ /&#x000A; /:/__/ /:/\:\ \ /:|:| | /:/ / &#x000A; /::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ / &#x000A; /:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/ &#x000A; \/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \ &#x000A; \::/ / \::/ / /:/ / \:\ \ &#x000A; /:/ / /:/ / /:/ / \:\ \ &#x000A; /:/ / /:/ / /:/ / \:\__\&#x000A; \/__/ \/__/ \/__/ \/__/&#x000A;&#x000A; Many&#x000A; thanks&#x000A; to&#x000A; http://www.network-science.de/ascii/&#x000A;
92
+ <strong>indeed!</strong>
93
+ </textarea>
94
+ </div>
95
+ <div class='foo'>
96
+ 13
97
+ </div>
98
+ <pre>
99
+ __ ______ __ ______&#x000A;.----.| |--.|__ |.----.| |--..--------.| __ |&#x000A;| __|| ||__ || __|| < | || __ |&#x000A;|____||__|__||______||____||__|__||__|__|__||______|&#x000A;
100
+ </pre>
101
+ <pre>
102
+ foo&#x000A;
103
+ bar
104
+ </pre>
@@ -6,7 +6,7 @@
6
6
  </head>
7
7
  <body>
8
8
  <!-- You're In my house now! -->
9
- <% concat "Foo", Proc.new {} %>
9
+ <% concat("Foo", Proc.new {}) %>
10
10
  <div class='header'>
11
11
  Yes, ladies and gentileman. He is just that egotistical.
12
12
  Fantastic! This should be multi-line output
@@ -14,6 +14,9 @@
14
14
  <%= 1 + 9 + 8 + 2 %>
15
15
  <%# numbers should work and this should be ignored %>
16
16
  </div>
17
+ <% 120.times do |number| -%>
18
+ <%= number %>
19
+ <% end -%>
17
20
  <div id='body'><%= " Quotes should be loved! Just like people!" %></div>
18
21
  Wow.
19
22
  <p>
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'active_support'
3
3
  require 'action_view'
4
- require '../lib/haml/template'
4
+ require '../../lib/haml/template'
5
5
  require 'fileutils'
6
6
 
7
7
  haml_template_engine = Haml::Template.new(ActionView::Base.new)
@@ -5,19 +5,30 @@ require 'rubygems'
5
5
  require 'active_support'
6
6
  require 'action_view'
7
7
 
8
- require File.dirname(__FILE__) + '/../lib/haml/template'
8
+ require File.dirname(__FILE__) + '/../../lib/haml'
9
+ require 'haml/template'
9
10
  require File.dirname(__FILE__) + '/mocks/article'
10
11
 
12
+ class TestFilter
13
+ def initialize(text)
14
+ @text = text
15
+ end
16
+
17
+ def render
18
+ "TESTING HAHAHAHA!"
19
+ end
20
+ end
21
+
11
22
  class TemplateTest < Test::Unit::TestCase
12
23
  @@templates = %w{ very_basic standard helpers
13
24
  whitespace_handling original_engine list helpful
14
- silent_script tag_parsing just_stuff partials }
25
+ silent_script tag_parsing just_stuff partials
26
+ filters }
15
27
 
16
28
  def setup
17
29
  ActionView::Base.register_template_handler("haml", Haml::Template)
18
- @base = ActionView::Base.new(File.dirname(__FILE__) + "/../test/templates/")
19
- @base.instance_variable_set("@article", Article.new)
20
- @base.instance_variable_set("@foo", 'value one')
30
+ Haml::Template.options = { :filters => { 'test'=>TestFilter } }
31
+ @base = ActionView::Base.new(File.dirname(__FILE__) + "/templates/", {'article' => Article.new, 'foo' => 'value one'})
21
32
  end
22
33
 
23
34
  def render(text)
@@ -34,7 +45,7 @@ class TemplateTest < Test::Unit::TestCase
34
45
  test = Proc.new do |rendered|
35
46
  load_result(name).split("\n").zip(rendered.split("\n")).each_with_index do |pair, line|
36
47
  message = "template: #{name}\nline: #{line}"
37
- assert_equal(pair.first, pair.last, message)
48
+ assert_equal(pair.last, pair.first, message)
38
49
  end
39
50
  end
40
51
  test.call(@base.render(name))
@@ -100,28 +111,20 @@ class TemplateTest < Test::Unit::TestCase
100
111
  end
101
112
 
102
113
  def test_exceptions_should_work_correctly
103
- template = <<END
104
- %p
105
- %h1 Hello!
106
- = "lots of lines"
107
- - raise "Oh no!"
108
- %p
109
- this is after the exception
110
- %strong yes it is!
111
- ho ho ho.
112
- END
113
- @base.haml_filename = "(test)"
114
114
  begin
115
- render(template.chomp)
115
+ Haml::Template.new(@base).render(File.dirname(__FILE__) + '/templates/breakage.haml')
116
116
  rescue Exception => e
117
- assert_equal("(test).haml:4", e.backtrace[0])
117
+ assert_equal("./test/haml/templates/breakage.haml:4", e.backtrace[0])
118
+ else
119
+ assert false
118
120
  end
119
121
 
120
- @base.haml_filename = nil
121
122
  begin
122
- render(template.chomp)
123
+ render("- raise 'oops!'")
123
124
  rescue Exception => e
124
- assert_equal("(haml):4", e.backtrace[0])
125
+ assert_equal("(haml):1", e.backtrace[0])
126
+ else
127
+ assert false
125
128
  end
126
129
 
127
130
  template = <<END
@@ -129,7 +132,7 @@ END
129
132
  %h1 Hello!
130
133
  = "lots of lines"
131
134
  = "even more!"
132
- - compile_error(
135
+ - raise 'oh no!'
133
136
  %p
134
137
  this is after the exception
135
138
  %strong yes it is!
@@ -140,6 +143,8 @@ END
140
143
  render(template.chomp)
141
144
  rescue Exception => e
142
145
  assert_equal("(haml):5", e.backtrace[0])
146
+ else
147
+ assert false
143
148
  end
144
149
  end
145
150
  end
@@ -0,0 +1,8 @@
1
+ %p
2
+ %h1 Hello!
3
+ = "lots of lines"
4
+ - raise "Oh no!"
5
+ %p
6
+ this is after the exception
7
+ %strong yes it is!
8
+ ho ho ho.
@@ -0,0 +1,53 @@
1
+ %style
2
+ :sass
3
+ p
4
+ :border
5
+ :style dotted
6
+ :width 10px
7
+ :color #ff00ff
8
+ h1
9
+ :font-weight normal
10
+
11
+ :test
12
+ This
13
+ Should
14
+ Not
15
+ Print
16
+
17
+ :redcloth
18
+ Foo
19
+ ===
20
+
21
+ This is preformatted!
22
+ Look at that!
23
+ Wowie-zowie!
24
+
25
+ *boldilicious!*
26
+
27
+ :textile
28
+ h1. Yeah
29
+
30
+ _pretty much the same as above_
31
+
32
+ :plain
33
+ This
34
+ Is
35
+ Plain
36
+ Text
37
+ %strong right?
38
+
39
+ :erb
40
+ <% 10.times do |c| %>
41
+ <%= (c+97).chr %>
42
+ <% end %>
43
+
44
+ :markdown
45
+ * Foo
46
+ * Bar
47
+ * BAZ!
48
+
49
+ = "Text!"
50
+
51
+ :ruby
52
+ puts "Hello, World!"
53
+ puts "How are you doing today?"