radiant 0.6.6 → 0.6.7

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

Potentially problematic release.


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

Files changed (208) hide show
  1. data/CHANGELOG +15 -0
  2. data/CONTRIBUTORS +8 -0
  3. data/app/controllers/admin/page_controller.rb +1 -11
  4. data/app/controllers/admin/welcome_controller.rb +5 -6
  5. data/app/controllers/application.rb +2 -0
  6. data/app/controllers/site_controller.rb +1 -0
  7. data/app/helpers/admin/page_helper.rb +36 -0
  8. data/app/helpers/admin/regions_helper.rb +28 -0
  9. data/app/helpers/admin/user_helper.rb +6 -0
  10. data/app/helpers/application_helper.rb +2 -1
  11. data/app/models/user.rb +7 -8
  12. data/app/views/admin/extension/index.html.haml +28 -0
  13. data/app/views/admin/layout/edit.html.haml +44 -0
  14. data/app/views/admin/layout/index.html.haml +25 -0
  15. data/app/views/admin/layout/remove.html.haml +16 -0
  16. data/app/views/admin/page/_meta_row.html.haml +6 -0
  17. data/app/views/admin/page/_node.html.haml +25 -0
  18. data/app/views/admin/page/_part.html.haml +17 -0
  19. data/app/views/admin/page/_tag_reference.html.haml +3 -0
  20. data/app/views/admin/page/children.html.haml +2 -0
  21. data/app/views/admin/page/edit.html.haml +114 -0
  22. data/app/views/admin/page/index.html.haml +28 -0
  23. data/app/views/admin/page/remove.html.haml +20 -0
  24. data/app/views/admin/snippet/edit.html.haml +36 -0
  25. data/app/views/admin/snippet/index.html.haml +20 -0
  26. data/app/views/admin/snippet/remove.html.haml +19 -0
  27. data/app/views/admin/user/edit.html.haml +80 -0
  28. data/app/views/admin/user/index.html.haml +23 -0
  29. data/app/views/admin/user/preferences.html.haml +28 -0
  30. data/app/views/admin/user/remove.html.haml +18 -0
  31. data/app/views/admin/welcome/login.html.haml +44 -0
  32. data/app/views/layouts/application.html.haml +54 -0
  33. data/app/views/site/not_found.html.haml +3 -0
  34. data/db/migrate/019_add_salt_to_users.rb +11 -0
  35. data/db/schema.rb +2 -1
  36. data/lib/login_system.rb +1 -0
  37. data/lib/radiant.rb +1 -1
  38. data/lib/radiant/admin_ui.rb +65 -0
  39. data/lib/radiant/admin_ui/region_partials.rb +18 -0
  40. data/lib/radiant/admin_ui/region_set.rb +35 -0
  41. data/lib/tasks/extensions.rake +33 -0
  42. data/public/javascripts/admin/admin.js +8 -2
  43. data/public/javascripts/admin/sitemap.js +2 -1
  44. data/public/stylesheets/admin/main.css +4 -0
  45. data/spec/controllers/admin/abstract_model_controller_spec.rb +2 -0
  46. data/spec/controllers/admin/page_controller_spec.rb +3 -28
  47. data/spec/controllers/admin/user_controller_spec.rb +1 -1
  48. data/spec/controllers/admin/welcome_controller_spec.rb +26 -0
  49. data/spec/helpers/admin/page_helper_spec.rb +4 -0
  50. data/spec/helpers/admin/regions_helper_spec.rb +47 -0
  51. data/spec/helpers/admin/user_helper_spec.rb +7 -0
  52. data/spec/helpers/application_helper_spec.rb +7 -3
  53. data/spec/lib/login_system_spec.rb +5 -0
  54. data/spec/lib/radiant/admin_ui/region_partials_spec.rb +35 -0
  55. data/spec/lib/radiant/admin_ui/region_set_spec.rb +61 -0
  56. data/spec/lib/radiant/admin_ui_spec.rb +74 -18
  57. data/spec/models/user_spec.rb +11 -4
  58. data/spec/scenarios/users_scenario.rb +2 -2
  59. data/vendor/plugins/haml/MIT-LICENSE +20 -0
  60. data/vendor/plugins/haml/README.rdoc +319 -0
  61. data/vendor/plugins/haml/Rakefile +158 -0
  62. data/vendor/plugins/haml/TODO +9 -0
  63. data/vendor/plugins/haml/VERSION +1 -0
  64. data/vendor/plugins/haml/bin/css2sass +7 -0
  65. data/vendor/plugins/haml/bin/haml +8 -0
  66. data/vendor/plugins/haml/bin/html2haml +7 -0
  67. data/vendor/plugins/haml/bin/sass +8 -0
  68. data/vendor/plugins/haml/extra/haml-mode.el +328 -0
  69. data/vendor/plugins/haml/extra/sass-mode.el +88 -0
  70. data/vendor/plugins/haml/init.rb +2 -0
  71. data/vendor/plugins/haml/lib/haml.rb +977 -0
  72. data/vendor/plugins/haml/lib/haml/buffer.rb +229 -0
  73. data/vendor/plugins/haml/lib/haml/engine.rb +274 -0
  74. data/vendor/plugins/haml/lib/haml/error.rb +23 -0
  75. data/vendor/plugins/haml/lib/haml/exec.rb +347 -0
  76. data/vendor/plugins/haml/lib/haml/filters.rb +249 -0
  77. data/vendor/plugins/haml/lib/haml/helpers.rb +413 -0
  78. data/vendor/plugins/haml/lib/haml/helpers/action_view_extensions.rb +45 -0
  79. data/vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb +122 -0
  80. data/vendor/plugins/haml/lib/haml/html.rb +188 -0
  81. data/vendor/plugins/haml/lib/haml/precompiler.rb +757 -0
  82. data/vendor/plugins/haml/lib/haml/template.rb +43 -0
  83. data/vendor/plugins/haml/lib/haml/template/patch.rb +58 -0
  84. data/vendor/plugins/haml/lib/haml/template/plugin.rb +72 -0
  85. data/vendor/plugins/haml/lib/sass.rb +833 -0
  86. data/vendor/plugins/haml/lib/sass/constant.rb +245 -0
  87. data/vendor/plugins/haml/lib/sass/constant/color.rb +101 -0
  88. data/vendor/plugins/haml/lib/sass/constant/literal.rb +53 -0
  89. data/vendor/plugins/haml/lib/sass/constant/number.rb +87 -0
  90. data/vendor/plugins/haml/lib/sass/constant/operation.rb +30 -0
  91. data/vendor/plugins/haml/lib/sass/constant/string.rb +22 -0
  92. data/vendor/plugins/haml/lib/sass/css.rb +378 -0
  93. data/vendor/plugins/haml/lib/sass/engine.rb +459 -0
  94. data/vendor/plugins/haml/lib/sass/error.rb +35 -0
  95. data/vendor/plugins/haml/lib/sass/plugin.rb +165 -0
  96. data/vendor/plugins/haml/lib/sass/plugin/merb.rb +56 -0
  97. data/vendor/plugins/haml/lib/sass/plugin/rails.rb +24 -0
  98. data/vendor/plugins/haml/lib/sass/tree/attr_node.rb +53 -0
  99. data/vendor/plugins/haml/lib/sass/tree/comment_node.rb +20 -0
  100. data/vendor/plugins/haml/lib/sass/tree/directive_node.rb +46 -0
  101. data/vendor/plugins/haml/lib/sass/tree/node.rb +42 -0
  102. data/vendor/plugins/haml/lib/sass/tree/rule_node.rb +89 -0
  103. data/vendor/plugins/haml/lib/sass/tree/value_node.rb +16 -0
  104. data/vendor/plugins/haml/test/benchmark.rb +82 -0
  105. data/vendor/plugins/haml/test/haml/engine_test.rb +587 -0
  106. data/vendor/plugins/haml/test/haml/helper_test.rb +187 -0
  107. data/vendor/plugins/haml/test/haml/html2haml_test.rb +60 -0
  108. data/vendor/plugins/haml/test/haml/markaby/standard.mab +52 -0
  109. data/vendor/plugins/haml/test/haml/mocks/article.rb +6 -0
  110. data/vendor/plugins/haml/test/haml/results/content_for_layout.xhtml +16 -0
  111. data/vendor/plugins/haml/test/haml/results/eval_suppressed.xhtml +11 -0
  112. data/vendor/plugins/haml/test/haml/results/filters.xhtml +82 -0
  113. data/vendor/plugins/haml/test/haml/results/helpers.xhtml +94 -0
  114. data/vendor/plugins/haml/test/haml/results/helpful.xhtml +10 -0
  115. data/vendor/plugins/haml/test/haml/results/just_stuff.xhtml +64 -0
  116. data/vendor/plugins/haml/test/haml/results/list.xhtml +12 -0
  117. data/vendor/plugins/haml/test/haml/results/original_engine.xhtml +22 -0
  118. data/vendor/plugins/haml/test/haml/results/partials.xhtml +21 -0
  119. data/vendor/plugins/haml/test/haml/results/silent_script.xhtml +74 -0
  120. data/vendor/plugins/haml/test/haml/results/standard.xhtml +42 -0
  121. data/vendor/plugins/haml/test/haml/results/tag_parsing.xhtml +28 -0
  122. data/vendor/plugins/haml/test/haml/results/very_basic.xhtml +7 -0
  123. data/vendor/plugins/haml/test/haml/results/whitespace_handling.xhtml +94 -0
  124. data/vendor/plugins/haml/test/haml/rhtml/_av_partial_1.rhtml +12 -0
  125. data/vendor/plugins/haml/test/haml/rhtml/_av_partial_2.rhtml +8 -0
  126. data/vendor/plugins/haml/test/haml/rhtml/action_view.rhtml +62 -0
  127. data/vendor/plugins/haml/test/haml/rhtml/standard.rhtml +54 -0
  128. data/vendor/plugins/haml/test/haml/template_test.rb +168 -0
  129. data/vendor/plugins/haml/test/haml/templates/_av_partial_1.haml +9 -0
  130. data/vendor/plugins/haml/test/haml/templates/_av_partial_2.haml +5 -0
  131. data/vendor/plugins/haml/test/haml/templates/_partial.haml +8 -0
  132. data/vendor/plugins/haml/test/haml/templates/_text_area.haml +3 -0
  133. data/vendor/plugins/haml/test/haml/templates/action_view.haml +47 -0
  134. data/vendor/plugins/haml/test/haml/templates/breakage.haml +8 -0
  135. data/vendor/plugins/haml/test/haml/templates/content_for_layout.haml +10 -0
  136. data/vendor/plugins/haml/test/haml/templates/eval_suppressed.haml +11 -0
  137. data/vendor/plugins/haml/test/haml/templates/filters.haml +81 -0
  138. data/vendor/plugins/haml/test/haml/templates/helpers.haml +69 -0
  139. data/vendor/plugins/haml/test/haml/templates/helpful.haml +11 -0
  140. data/vendor/plugins/haml/test/haml/templates/just_stuff.haml +77 -0
  141. data/vendor/plugins/haml/test/haml/templates/list.haml +12 -0
  142. data/vendor/plugins/haml/test/haml/templates/original_engine.haml +17 -0
  143. data/vendor/plugins/haml/test/haml/templates/partialize.haml +1 -0
  144. data/vendor/plugins/haml/test/haml/templates/partials.haml +12 -0
  145. data/vendor/plugins/haml/test/haml/templates/silent_script.haml +40 -0
  146. data/vendor/plugins/haml/test/haml/templates/standard.haml +42 -0
  147. data/vendor/plugins/haml/test/haml/templates/tag_parsing.haml +24 -0
  148. data/vendor/plugins/haml/test/haml/templates/very_basic.haml +4 -0
  149. data/vendor/plugins/haml/test/haml/templates/whitespace_handling.haml +87 -0
  150. data/vendor/plugins/haml/test/haml/test_helper.rb +15 -0
  151. data/vendor/plugins/haml/test/profile.rb +65 -0
  152. data/vendor/plugins/haml/test/sass/engine_test.rb +276 -0
  153. data/vendor/plugins/haml/test/sass/plugin_test.rb +159 -0
  154. data/vendor/plugins/haml/test/sass/results/alt.css +4 -0
  155. data/vendor/plugins/haml/test/sass/results/basic.css +9 -0
  156. data/vendor/plugins/haml/test/sass/results/compact.css +5 -0
  157. data/vendor/plugins/haml/test/sass/results/complex.css +87 -0
  158. data/vendor/plugins/haml/test/sass/results/compressed.css +1 -0
  159. data/vendor/plugins/haml/test/sass/results/constants.css +14 -0
  160. data/vendor/plugins/haml/test/sass/results/expanded.css +19 -0
  161. data/vendor/plugins/haml/test/sass/results/import.css +29 -0
  162. data/vendor/plugins/haml/test/sass/results/mixins.css +95 -0
  163. data/vendor/plugins/haml/test/sass/results/multiline.css +24 -0
  164. data/vendor/plugins/haml/test/sass/results/nested.css +22 -0
  165. data/vendor/plugins/haml/test/sass/results/parent_ref.css +13 -0
  166. data/vendor/plugins/haml/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
  167. data/vendor/plugins/haml/test/sass/results/subdir/subdir.css +1 -0
  168. data/vendor/plugins/haml/test/sass/templates/_partial.sass +2 -0
  169. data/vendor/plugins/haml/test/sass/templates/alt.sass +16 -0
  170. data/vendor/plugins/haml/test/sass/templates/basic.sass +23 -0
  171. data/vendor/plugins/haml/test/sass/templates/bork.sass +2 -0
  172. data/vendor/plugins/haml/test/sass/templates/bork2.sass +2 -0
  173. data/vendor/plugins/haml/test/sass/templates/compact.sass +17 -0
  174. data/vendor/plugins/haml/test/sass/templates/complex.sass +310 -0
  175. data/vendor/plugins/haml/test/sass/templates/compressed.sass +15 -0
  176. data/vendor/plugins/haml/test/sass/templates/constants.sass +97 -0
  177. data/vendor/plugins/haml/test/sass/templates/expanded.sass +17 -0
  178. data/vendor/plugins/haml/test/sass/templates/import.sass +11 -0
  179. data/vendor/plugins/haml/test/sass/templates/importee.sass +14 -0
  180. data/vendor/plugins/haml/test/sass/templates/mixins.sass +76 -0
  181. data/vendor/plugins/haml/test/sass/templates/multiline.sass +20 -0
  182. data/vendor/plugins/haml/test/sass/templates/nested.sass +25 -0
  183. data/vendor/plugins/haml/test/sass/templates/parent_ref.sass +25 -0
  184. data/vendor/plugins/haml/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
  185. data/vendor/plugins/haml/test/sass/templates/subdir/subdir.sass +6 -0
  186. metadata +185 -24
  187. data/app/views/admin/extension/index.html.erb +0 -40
  188. data/app/views/admin/layout/edit.html.erb +0 -39
  189. data/app/views/admin/layout/index.html.erb +0 -38
  190. data/app/views/admin/layout/remove.html.erb +0 -17
  191. data/app/views/admin/page/_meta_row.html.erb +0 -4
  192. data/app/views/admin/page/_node.html.erb +0 -28
  193. data/app/views/admin/page/_part.html.erb +0 -13
  194. data/app/views/admin/page/_tag_reference.html.erb +0 -4
  195. data/app/views/admin/page/children.html.erb +0 -4
  196. data/app/views/admin/page/edit.html.erb +0 -140
  197. data/app/views/admin/page/index.html.erb +0 -31
  198. data/app/views/admin/page/remove.html.erb +0 -14
  199. data/app/views/admin/snippet/edit.html.erb +0 -29
  200. data/app/views/admin/snippet/index.html.erb +0 -36
  201. data/app/views/admin/snippet/remove.html.erb +0 -16
  202. data/app/views/admin/user/edit.html.erb +0 -54
  203. data/app/views/admin/user/index.html.erb +0 -43
  204. data/app/views/admin/user/preferences.html.erb +0 -29
  205. data/app/views/admin/user/remove.html.erb +0 -16
  206. data/app/views/admin/welcome/login.html.erb +0 -51
  207. data/app/views/layouts/application.html.erb +0 -83
  208. data/app/views/site/not_found.html.erb +0 -3
@@ -0,0 +1,54 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-US'>
3
+ <head>
4
+ <title>Hampton Catlin Is Totally Awesome</title>
5
+ <meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
6
+ </head>
7
+ <body>
8
+ <!-- You're In my house now! -->
9
+ <div class='header'>
10
+ Yes, ladies and gentileman. He is just that egotistical.
11
+ Fantastic! This should be multi-line output
12
+ The question is if this would translate! Ahah!
13
+ <%= 1 + 9 + 8 + 2 %>
14
+ <%# numbers should work and this should be ignored %>
15
+ </div>
16
+ <% 120.times do |number| -%>
17
+ <%= number %>
18
+ <% end -%>
19
+ <div id='body'><%= " Quotes should be loved! Just like people!" %></div>
20
+ Wow.
21
+ <p>
22
+ <%= "Holy cow " +
23
+ "multiline " +
24
+ "tags! " +
25
+ "A pipe (|) even!" %>
26
+ <%= [1, 2, 3].collect { |n| "PipesIgnored|" } %>
27
+ <%= [1, 2, 3].collect { |n|
28
+ n.to_s
29
+ }.join("|") %>
30
+ </p>
31
+ <div class='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
+ </div>
39
+ <ul class='really cool'>
40
+ <% ('a'..'f').each do |a|%>
41
+ <li><%= a %>
42
+ <% end %>
43
+ <div class='of_divs_with_underscore' id='combo'><%= @should_eval = "with this text" %></div>
44
+ <%= [ 104, 101, 108, 108, 111 ].map do |byte|
45
+ byte.chr
46
+ end %>
47
+ <div class='footer'>
48
+ <strong class='shout'>
49
+ <%= "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.\n" +
50
+ " So, I'm just making it *really* long. God, I hope this works" %>
51
+ </strong>
52
+ </div>
53
+ </body>
54
+ </html>
@@ -0,0 +1,168 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/test_helper'
3
+ require 'haml/template'
4
+ require File.dirname(__FILE__) + '/mocks/article'
5
+
6
+ module TestFilter
7
+ include Haml::Filters::Base
8
+
9
+ def render(text)
10
+ "TESTING HAHAHAHA!"
11
+ end
12
+ end
13
+
14
+ class TemplateTest < Test::Unit::TestCase
15
+ @@templates = %w{ very_basic standard helpers
16
+ whitespace_handling original_engine list helpful
17
+ silent_script tag_parsing just_stuff partials
18
+ filters }
19
+
20
+ def setup
21
+ Haml::Template.options = { :filters => { 'test'=>TestFilter } }
22
+ @base = ActionView::Base.new(File.dirname(__FILE__) + "/templates/", {'article' => Article.new, 'foo' => 'value one'})
23
+ @base.send(:evaluate_assigns)
24
+
25
+ # This is used by form_for.
26
+ # It's usually provided by ActionController::Base.
27
+ def @base.protect_against_forgery?; false; end
28
+ end
29
+
30
+ def render(text)
31
+ Haml::Engine.new(text).to_html(@base)
32
+ end
33
+
34
+ def load_result(name)
35
+ @result = ''
36
+ File.new(File.dirname(__FILE__) + "/results/#{name}.xhtml").each_line { |l| @result += l }
37
+ @result
38
+ end
39
+
40
+ def assert_renders_correctly(name, &render_method)
41
+ render_method ||= proc { |name| @base.render(name) }
42
+ test = Proc.new do |rendered|
43
+ load_result(name).split("\n").zip(rendered.split("\n")).each_with_index do |pair, line|
44
+ message = "template: #{name}\nline: #{line}"
45
+ assert_equal(pair.first, pair.last, message)
46
+ end
47
+ end
48
+ begin
49
+ test.call(render_method[name])
50
+ rescue ActionView::TemplateError => e
51
+ if e.message =~ /Can't run [\w:]+ filter; required (one of|file) ((?:'\w+'(?: or )?)+)(, but none were found| not found)/
52
+ puts "\nCouldn't require #{$2}; skipping a test."
53
+ else
54
+ raise e
55
+ end
56
+ end
57
+ end
58
+
59
+ def test_empty_render_should_remain_empty
60
+ assert_equal('', render(''))
61
+ end
62
+
63
+ def test_templates_should_render_correctly
64
+ @@templates.each do |template|
65
+ assert_renders_correctly template
66
+ end
67
+ end
68
+
69
+ def test_templates_should_render_correctly_with_render_proc
70
+ @@templates.each do |template|
71
+ assert_renders_correctly(template) do |name|
72
+ engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"), :filters => { 'test'=>TestFilter })
73
+ engine.render_proc(@base).call
74
+ end
75
+ end
76
+ end
77
+
78
+ def test_templates_should_render_correctly_with_def_method
79
+ @@templates.each do |template|
80
+ assert_renders_correctly(template) do |name|
81
+ method = "render_haml_" + name.gsub(/[^a-zA-Z0-9]/, '_')
82
+
83
+ engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"), :filters => { 'test'=>TestFilter })
84
+ engine.def_method(@base, method)
85
+ @base.send(method)
86
+ end
87
+ end
88
+ end
89
+
90
+ def test_action_view_templates_render_correctly
91
+ @base.instance_variable_set("@content_for_layout", 'Lorem ipsum dolor sit amet')
92
+ assert_renders_correctly 'content_for_layout'
93
+ end
94
+
95
+ def test_instance_variables_should_work_inside_templates
96
+ @base.instance_variable_set("@content_for_layout", 'something')
97
+ assert_equal("<p>something</p>", render("%p= @content_for_layout").chomp)
98
+
99
+ @base.instance_eval("@author = 'Hampton Catlin'")
100
+ assert_equal("<div class='author'>Hampton Catlin</div>", render(".author= @author").chomp)
101
+
102
+ @base.instance_eval("@author = 'Hampton'")
103
+ assert_equal("Hampton", render("= @author").chomp)
104
+
105
+ @base.instance_eval("@author = 'Catlin'")
106
+ assert_equal("Catlin", render("= @author").chomp)
107
+ end
108
+
109
+ def test_instance_variables_should_work_inside_attributes
110
+ @base.instance_eval("@author = 'hcatlin'")
111
+ assert_equal("<p class='hcatlin'>foo</p>", render("%p{:class => @author} foo").chomp)
112
+ end
113
+
114
+ def test_template_renders_should_eval
115
+ assert_equal("2\n", render("= 1+1"))
116
+ end
117
+
118
+ def test_rhtml_still_renders
119
+ # Make sure it renders normally
120
+ res = @base.render("../rhtml/standard")
121
+ assert !(res.nil? || res.empty?)
122
+
123
+ # Register Haml stuff in @base...
124
+ @base.render("standard")
125
+
126
+ # Does it still render?
127
+ res = @base.render("../rhtml/standard")
128
+ assert !(res.nil? || res.empty?)
129
+ end
130
+
131
+ def test_haml_options
132
+ Haml::Template.options = { :suppress_eval => true }
133
+ assert_equal({ :suppress_eval => true }, Haml::Template.options)
134
+ assert_renders_correctly("eval_suppressed")
135
+ Haml::Template.options = {}
136
+ end
137
+
138
+ def test_exceptions_should_work_correctly
139
+ begin
140
+ render("- raise 'oops!'")
141
+ rescue Exception => e
142
+ assert_equal("oops!", e.message)
143
+ assert_match(/^\(haml\):1/, e.backtrace[0])
144
+ else
145
+ assert false
146
+ end
147
+
148
+ template = <<END
149
+ %p
150
+ %h1 Hello!
151
+ = "lots of lines"
152
+ = "even more!"
153
+ - raise 'oh no!'
154
+ %p
155
+ this is after the exception
156
+ %strong yes it is!
157
+ ho ho ho.
158
+ END
159
+
160
+ begin
161
+ render(template.chomp)
162
+ rescue Exception => e
163
+ assert_match(/^\(haml\):5/, e.backtrace[0])
164
+ else
165
+ assert false
166
+ end
167
+ end
168
+ end
@@ -0,0 +1,9 @@
1
+ %h2 This is a pretty complicated partial
2
+ .partial
3
+ %p It has several nested partials,
4
+ %ul
5
+ - 5.times do
6
+ %li
7
+ %strong Partial:
8
+ - @nesting = 5
9
+ = render :partial => 'haml/templates/av_partial_2'
@@ -0,0 +1,5 @@
1
+ - @nesting -= 1
2
+ .partial{:level => @nesting}
3
+ %h3 This is a crazy deep-nested partial.
4
+ %p== Nesting level #{@nesting}
5
+ = render :partial => 'haml/templates/av_partial_2' if @nesting > 0
@@ -0,0 +1,8 @@
1
+ %p
2
+ @foo =
3
+ = @foo
4
+ - @foo = 'value three'
5
+ == Toplevel? #{haml_buffer.toplevel?}
6
+ %p
7
+ @foo =
8
+ = @foo
@@ -0,0 +1,3 @@
1
+ .text_area_test_area
2
+ ~ "<textarea>" + value + "</textarea>"
3
+ = "<textarea>BLAH\n</textarea>"
@@ -0,0 +1,47 @@
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 => 'haml/templates/av_partial_1'
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"
@@ -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,10 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %body
5
+ #content
6
+ = @content_for_layout
7
+ #yieldy
8
+ = yield :layout
9
+ #nosym
10
+ = yield
@@ -0,0 +1,11 @@
1
+ = "not me!"
2
+ = "nor me!"
3
+ - puts "not even me!"
4
+ %p= "NO!"
5
+ %p~ "UH-UH!"
6
+ %h1 Me!
7
+ #foo
8
+ %p#bar All
9
+ %br/
10
+ %p.baz This
11
+ Should render
@@ -0,0 +1,81 @@
1
+ %style
2
+ - width = 5 + 17
3
+ :sass
4
+ p
5
+ :border
6
+ :style dotted
7
+ :width #{width}px
8
+ :color #ff00ff
9
+ h1
10
+ :font-weight normal
11
+
12
+ :test
13
+ This
14
+ Should
15
+ Not
16
+ Print
17
+
18
+ :redcloth
19
+ Foo
20
+ ===
21
+
22
+ This is preformatted!
23
+ Look at that!
24
+ Wowie-zowie!
25
+
26
+ *boldilicious!*
27
+
28
+ :textile
29
+ h1. Yeah
30
+
31
+ _pretty much the same as above_
32
+
33
+ %p
34
+ :javascript
35
+ function newline(str) {
36
+ return "\n" + str;
37
+ }
38
+
39
+ :plain
40
+ This
41
+ Is
42
+ Plain
43
+ Text
44
+ %strong right?
45
+ \#{not interpolated}
46
+ \\#{1 + 2}
47
+ \\\#{also not}
48
+ \\
49
+
50
+ - last = "noitalo"
51
+ %p
52
+ %pre
53
+ :preserve
54
+ This pre is pretty deeply
55
+ nested.
56
+ Does #{"interp" + last.reverse} work?
57
+ :preserve
58
+ This one is, too.
59
+ Nested, that is.
60
+
61
+ - num = 10
62
+ %ul
63
+ :erb
64
+ <% num.times do |c| %>
65
+ <li><%= (c+97).chr %></li>
66
+ <% end %>
67
+ <% res = 178 %>
68
+
69
+ .res= res
70
+
71
+ :markdown
72
+ * Foo
73
+ * Bar
74
+ * BAZ!
75
+
76
+ = "Text!"
77
+
78
+ - var = "Hello"
79
+ :ruby
80
+ printf "%s, World!\n", var
81
+ print "How are you doing today?\n"
@@ -0,0 +1,69 @@
1
+ = h("&&&&&&&&&&&") # This is an ActionView Helper... should load
2
+ - foo = capture do # This ActionView Helper is designed for ERB, but should work with haml
3
+ %div
4
+ %p.title Title
5
+ %p.text
6
+ Woah this is really crazy
7
+ I mean wow,
8
+ man.
9
+ - 3.times do
10
+ = foo
11
+ %p foo
12
+ - tab_up
13
+ %p reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeally loooooooooooooooooong
14
+ - tab_down
15
+ .woah
16
+ #funky
17
+ = capture_haml do
18
+ %div
19
+ %h1 Big!
20
+ %p Small
21
+ / Invisible
22
+ = capture do
23
+ .dilly
24
+ %p foo
25
+ %h1 bar
26
+ = surround '(', ')' do
27
+ %strong parentheses!
28
+ = precede '*' do
29
+ %span.small Not really
30
+ click
31
+ = succeed '.' do
32
+ %a{:href=>"thing"} here
33
+ %p baz
34
+ - haml_buffer.tabulation = 10
35
+ %p boom
36
+ - concat "foo\n"
37
+ - haml_buffer.tabulation = 0
38
+ - def url_for(*stuff); stuff.join(' '); end
39
+ -# The form URLs must be empty
40
+ -# because of a weird bug that causes url_for to misbehave.
41
+ %p
42
+ = form_tag ''
43
+ - form_tag '' do
44
+ %div= submit_tag 'save'
45
+ - @foo = 'value one'
46
+ = render :partial => './partial'
47
+ - form_for :article, @article, :url => '' do |f|
48
+ Title:
49
+ = f.text_field :title
50
+ Body:
51
+ = f.text_field :body
52
+ = list_of({:google => 'http://www.google.com'}) do |name, link|
53
+ %a{ :href => link }= name
54
+ %p
55
+ - puts "foo"
56
+ %div
57
+ - puts "bar"
58
+ - puts "boom"
59
+ baz
60
+ - puts "boom, again"
61
+ - haml_tag :table do
62
+ - haml_tag :tr do
63
+ - haml_tag :td, {:class => 'cell'} do
64
+ - haml_tag :strong, "strong!"
65
+ - puts "data"
66
+ - haml_tag :td do
67
+ - puts "more_data"
68
+ - haml_tag :hr
69
+ - haml_tag :div, ''