radiant 0.6.7 → 0.6.8

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 (96) hide show
  1. data/CHANGELOG +35 -3
  2. data/CONTRIBUTORS +11 -1
  3. data/README +5 -3
  4. data/app/controllers/admin/welcome_controller.rb +7 -0
  5. data/app/migrate/020_add_session_info_to_users.rb +11 -0
  6. data/app/models/page.rb +22 -9
  7. data/app/models/standard_tags.rb +133 -10
  8. data/app/models/user.rb +9 -1
  9. data/app/views/admin/page/edit.html.haml +5 -4
  10. data/app/views/admin/welcome/login.html.haml +42 -24
  11. data/app/views/layouts/application.html.haml +1 -1
  12. data/config/environment.rb +4 -2
  13. data/db/migrate/020_add_session_info_to_users.rb +11 -0
  14. data/db/migrate/021_remove_session_expire_from_users.rb +9 -0
  15. data/db/schema.rb +3 -2
  16. data/lib/generators/instance/instance_generator.rb +2 -1
  17. data/lib/generators/instance/templates/instance_environment.rb +5 -3
  18. data/lib/login_system.rb +13 -0
  19. data/lib/radiant.rb +1 -1
  20. data/lib/radiant/admin_ui.rb +21 -21
  21. data/lib/radiant/extension/script.rb +251 -0
  22. data/lib/radiant/extension_loader.rb +22 -20
  23. data/lib/radiant/initializer.rb +1 -1
  24. data/lib/radiant/setup.rb +2 -0
  25. data/lib/tasks/framework.rake +39 -29
  26. data/public/500.html +1 -1
  27. data/public/javascripts/admin/admin.js +11 -9
  28. data/script/extension +5 -0
  29. data/spec/controllers/admin/user_controller_spec.rb +1 -1
  30. data/spec/controllers/admin/welcome_controller_spec.rb +31 -5
  31. data/spec/controllers/site_controller_spec.rb +15 -2
  32. data/spec/lib/login_system_spec.rb +106 -60
  33. data/spec/lib/radiant/extension/script_spec.rb +349 -0
  34. data/spec/lib/radiant/extension_loader_spec.rb +3 -0
  35. data/spec/models/page_spec.rb +62 -2
  36. data/spec/models/standard_tags_spec.rb +150 -3
  37. data/spec/models/user_spec.rb +28 -0
  38. data/spec/scenarios/file_not_found_scenario.rb +5 -0
  39. data/spec/scenarios/pages_scenario.rb +6 -0
  40. data/spec/scenarios/snippets_scenario.rb +4 -0
  41. data/test/fixtures/users.yml +11 -6
  42. data/vendor/plugins/haml/FAQ +138 -0
  43. data/vendor/plugins/haml/REVISION +1 -0
  44. data/vendor/plugins/haml/Rakefile +54 -62
  45. data/vendor/plugins/haml/VERSION +1 -1
  46. data/vendor/plugins/haml/init.rb +6 -1
  47. data/vendor/plugins/haml/lib/haml.rb +72 -12
  48. data/vendor/plugins/haml/lib/haml/buffer.rb +47 -40
  49. data/vendor/plugins/haml/lib/haml/engine.rb +20 -30
  50. data/vendor/plugins/haml/lib/haml/error.rb +4 -5
  51. data/vendor/plugins/haml/lib/haml/exec.rb +4 -2
  52. data/vendor/plugins/haml/lib/haml/filters.rb +30 -15
  53. data/vendor/plugins/haml/lib/haml/helpers.rb +47 -28
  54. data/vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb +74 -25
  55. data/vendor/plugins/haml/lib/haml/precompiler.rb +92 -51
  56. data/vendor/plugins/haml/lib/haml/template.rb +11 -3
  57. data/vendor/plugins/haml/lib/haml/template/patch.rb +1 -1
  58. data/vendor/plugins/haml/lib/sass.rb +26 -3
  59. data/vendor/plugins/haml/lib/sass/constant.rb +26 -57
  60. data/vendor/plugins/haml/lib/sass/constant/literal.rb +1 -0
  61. data/vendor/plugins/haml/lib/sass/constant/nil.rb +9 -0
  62. data/vendor/plugins/haml/lib/sass/css.rb +17 -2
  63. data/vendor/plugins/haml/lib/sass/engine.rb +11 -5
  64. data/vendor/plugins/haml/test/haml/engine_test.rb +57 -39
  65. data/vendor/plugins/haml/test/haml/helper_test.rb +20 -4
  66. data/vendor/plugins/haml/test/haml/html2haml_test.rb +1 -3
  67. data/vendor/plugins/haml/test/haml/results/content_for_layout.xhtml +1 -2
  68. data/vendor/plugins/haml/test/haml/results/eval_suppressed.xhtml +2 -4
  69. data/vendor/plugins/haml/test/haml/results/filters.xhtml +12 -8
  70. data/vendor/plugins/haml/test/haml/results/helpers.xhtml +2 -5
  71. data/vendor/plugins/haml/test/haml/results/just_stuff.xhtml +1 -3
  72. data/vendor/plugins/haml/test/haml/results/nuke_inner_whitespace.xhtml +40 -0
  73. data/vendor/plugins/haml/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
  74. data/vendor/plugins/haml/test/haml/results/original_engine.xhtml +2 -4
  75. data/vendor/plugins/haml/test/haml/results/tag_parsing.xhtml +1 -6
  76. data/vendor/plugins/haml/test/haml/results/very_basic.xhtml +2 -4
  77. data/vendor/plugins/haml/test/haml/results/whitespace_handling.xhtml +13 -21
  78. data/vendor/plugins/haml/test/haml/template_test.rb +31 -48
  79. data/vendor/plugins/haml/test/haml/templates/filters.haml +13 -0
  80. data/vendor/plugins/haml/test/haml/templates/helpers.haml +1 -1
  81. data/vendor/plugins/haml/test/haml/templates/just_stuff.haml +0 -1
  82. data/vendor/plugins/haml/test/haml/templates/nuke_inner_whitespace.haml +32 -0
  83. data/vendor/plugins/haml/test/haml/templates/nuke_outer_whitespace.haml +144 -0
  84. data/vendor/plugins/haml/test/haml/templates/partials.haml +1 -1
  85. data/vendor/plugins/haml/test/haml/templates/tag_parsing.haml +0 -3
  86. data/vendor/plugins/haml/test/haml/templates/whitespace_handling.haml +10 -10
  87. data/vendor/plugins/haml/test/sass/engine_test.rb +11 -5
  88. data/vendor/plugins/haml/test/sass/plugin_test.rb +2 -6
  89. data/vendor/plugins/haml/test/sass/results/constants.css +2 -0
  90. data/vendor/plugins/haml/test/sass/templates/constants.sass +3 -0
  91. data/vendor/plugins/haml/test/{haml/test_helper.rb → test_helper.rb} +4 -3
  92. metadata +21 -11
  93. data/vendor/plugins/haml/TODO +0 -9
  94. data/vendor/plugins/haml/extra/haml-mode.el +0 -328
  95. data/vendor/plugins/haml/extra/sass-mode.el +0 -88
  96. data/vendor/plugins/haml/test/profile.rb +0 -65
@@ -0,0 +1,40 @@
1
+ <p>
2
+ <q>Foo</q>
3
+ </p>
4
+ <p>
5
+ <q a='2'>Foo</q>
6
+ </p>
7
+ <p>
8
+ <q>Foo
9
+ Bar</q>
10
+ </p>
11
+ <p>
12
+ <q a='2'>Foo
13
+ Bar</q>
14
+ </p>
15
+ <p>
16
+ <q>Foo
17
+ Bar</q>
18
+ </p>
19
+ <p>
20
+ <q a='2'>Foo
21
+ Bar</q>
22
+ </p>
23
+ <p>
24
+ <q><div>
25
+ Foo
26
+ Bar
27
+ </div></q>
28
+ </p>
29
+ <p>
30
+ <q a='2'><div>
31
+ Foo
32
+ Bar
33
+ </div></q>
34
+ </p>
35
+ <p>
36
+ <q>foo</q>
37
+ <q a='2'>
38
+ bar
39
+ </q>
40
+ </p>
@@ -0,0 +1,148 @@
1
+ <p>
2
+ <p><q>
3
+ Foo
4
+ </q></p>
5
+ </p>
6
+ <p>
7
+ <p><q a='2'>
8
+ Foo
9
+ </q></p>
10
+ </p>
11
+ <p>
12
+ <p><q>Foo</q></p>
13
+ </p>
14
+ <p>
15
+ <p><q a='2'>Foo</q></p>
16
+ </p>
17
+ <p>
18
+ <p><q>
19
+ Foo
20
+ </q></p>
21
+ </p>
22
+ <p>
23
+ <p><q a='2'>
24
+ Foo
25
+ </q></p>
26
+ </p>
27
+ <p>
28
+ <p><q>Foo</q></p>
29
+ </p>
30
+ <p>
31
+ <p><q a='2'>Foo</q></p>
32
+ </p>
33
+ <p>
34
+ <p><q>
35
+ Foo
36
+ Bar
37
+ </q></p>
38
+ </p>
39
+ <p>
40
+ <p><q a='2'>
41
+ Foo
42
+ Bar
43
+ </q></p>
44
+ </p>
45
+ <p>
46
+ <p><q>
47
+ Foo
48
+ Bar
49
+ </q></p>
50
+ </p>
51
+ <p>
52
+ <p><q a='2'>
53
+ Foo
54
+ Bar
55
+ </q></p>
56
+ </p>
57
+ <p>
58
+ <p>
59
+ foo<q>
60
+ Foo
61
+ </q>bar
62
+ </p>
63
+ </p>
64
+ <p>
65
+ <p>
66
+ foo<q a='2'>
67
+ Foo
68
+ </q>bar
69
+ </p>
70
+ </p>
71
+ <p>
72
+ <p>
73
+ foo<q>Foo</q>bar
74
+ </p>
75
+ </p>
76
+ <p>
77
+ <p>
78
+ foo<q a='2'>Foo</q>bar
79
+ </p>
80
+ </p>
81
+ <p>
82
+ <p>
83
+ foo<q>
84
+ Foo
85
+ </q>bar
86
+ </p>
87
+ </p>
88
+ <p>
89
+ <p>
90
+ foo<q a='2'>
91
+ Foo
92
+ </q>bar
93
+ </p>
94
+ </p>
95
+ <p>
96
+ <p>
97
+ foo<q>Foo</q>bar
98
+ </p>
99
+ </p>
100
+ <p>
101
+ <p>
102
+ foo<q a='2'>Foo</q>bar
103
+ </p>
104
+ </p>
105
+ <p>
106
+ <p>
107
+ foo<q>
108
+ Foo
109
+ Bar
110
+ </q>bar
111
+ </p>
112
+ </p>
113
+ <p>
114
+ <p>
115
+ foo<q a='2'>
116
+ Foo
117
+ Bar
118
+ </q>bar
119
+ </p>
120
+ </p>
121
+ <p>
122
+ <p>
123
+ foo<q>
124
+ Foo
125
+ Bar
126
+ </q>bar
127
+ </p>
128
+ </p>
129
+ <p>
130
+ <p>
131
+ foo<q a='2'>
132
+ Foo
133
+ Bar
134
+ </q>bar
135
+ </p>
136
+ </p>
137
+ <p>
138
+ <p><q></q></p>
139
+ </p>
140
+ <p>
141
+ <p><q /></p>
142
+ </p>
143
+ <p>
144
+ <p><q a='2'></q></p>
145
+ </p>
146
+ <p>
147
+ <p><q a='2' /></p>
148
+ </p>
@@ -13,10 +13,8 @@
13
13
  <li>Bathrobe</li>
14
14
  <li>Coffee</li>
15
15
  </ul>
16
- <pre>
17
- This is some text that's in a pre block!
18
- Let's see what happens when it's rendered! What about now, since we're on a new line?
19
- </pre>
16
+ <pre>This is some text that's in a pre block!
17
+ Let's see what happens when it's rendered! What about now, since we're on a new line?</pre>
20
18
  </div>
21
19
  </head>
22
20
  </html>
@@ -12,8 +12,7 @@
12
12
  <foo2u>11</foo2u>
13
13
  </div>
14
14
  <div class='classes'>
15
- <p class='foo bar' id='boom'>
16
- </p>
15
+ <p class='foo bar' id='boom'></p>
17
16
  <div class='fooBar'>a</div>
18
17
  <div class='foo-bar'>b</div>
19
18
  <div class='foo_bar'>c</div>
@@ -22,7 +21,3 @@
22
21
  <div class='123'>f</div>
23
22
  <div class='foo2u'>g</div>
24
23
  </div>
25
- <div class='broken'>
26
- <foo><{ :a => :b }</foo>
27
- <div class='foo'>>{ :c => :d }</div>
28
- </div>
@@ -1,7 +1,5 @@
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
- <head>
4
- </head>
5
- <body>
6
- </body>
3
+ <head></head>
4
+ <body></body>
7
5
  </html>
@@ -12,16 +12,16 @@
12
12
  <div class='text_area_test_area'>
13
13
  <textarea>Oneline</textarea>
14
14
  </div>
15
- <textarea>BLAH&#x000A;</textarea>
15
+ <textarea>BLAH</textarea>
16
16
  <div class='text_area_test_area'>
17
17
  <textarea>Two&#x000A;lines</textarea>
18
18
  </div>
19
- <textarea>BLAH&#x000A;</textarea>
19
+ <textarea>BLAH</textarea>
20
20
  <div id='flattened'>
21
21
  <div class='text_area_test_area'>
22
22
  <textarea>Two&#x000A;lines</textarea>
23
23
  </div>
24
- <textarea>BLAH&#x000A;</textarea>
24
+ <textarea>BLAH</textarea>
25
25
  </div>
26
26
  </div>
27
27
  <div class='hithere'>
@@ -36,7 +36,7 @@
36
36
  </div>
37
37
  <div class='foo'>
38
38
  13
39
- <textarea>&#x000A;a&#x000A;</textarea><textarea>&#x000A;b&#x000A;</textarea><textarea>&#x000A;c&#x000A;</textarea>
39
+ <textarea>&#x000A;a</textarea><textarea>&#x000A;b</textarea><textarea>&#x000A;c</textarea>
40
40
  </div>
41
41
  <div id='whitespace_test'>
42
42
  <div class='text_area_test_area'>
@@ -52,16 +52,16 @@
52
52
  <div class='text_area_test_area'>
53
53
  <textarea>Oneline</textarea>
54
54
  </div>
55
- <textarea>BLAH&#x000A;</textarea>
55
+ <textarea>BLAH</textarea>
56
56
  <div class='text_area_test_area'>
57
57
  <textarea>Two&#x000A;lines</textarea>
58
58
  </div>
59
- <textarea>BLAH&#x000A;</textarea>
59
+ <textarea>BLAH</textarea>
60
60
  <div id='flattened'>
61
61
  <div class='text_area_test_area'>
62
62
  <textarea>Two&#x000A;lines</textarea>
63
63
  </div>
64
- <textarea>BLAH&#x000A;</textarea>
64
+ <textarea>BLAH</textarea>
65
65
  </div>
66
66
  </div>
67
67
  <div class='hithere'>
@@ -73,22 +73,14 @@
73
73
  foo
74
74
  bar
75
75
  </p>
76
- <pre>
77
- ___&#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;
78
- </pre>
76
+ <pre> ___&#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!</pre>
79
77
  <strong>This should!</strong>
80
- <textarea>
81
- ___ ___ ___ ___ &#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;
82
- <strong>indeed!</strong>
83
- </textarea>
78
+ <textarea> ___ ___ ___ ___ &#x000A; /\__\ /\ \ /\__\ /\__\&#x000A; /:/ / /::\ \ /::| | /:/ /&#x000A; /:/__/ /:/\:\ \ /:|:| | /:/ / &#x000A; /::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ / &#x000A; /:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/ &#x000A; \/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \ &#x000A; \::/ / \::/ / /:/ / \:\ \ &#x000A; /:/ / /:/ / /:/ / \:\ \ &#x000A; /:/ / /:/ / /:/ / \:\__\&#x000A; \/__/ \/__/ \/__/ \/__/&#x000A; &#x000A; Many&#x000A; thanks&#x000A; to&#x000A; http://www.network-science.de/ascii/
79
+ <strong>indeed!</strong></textarea>
84
80
  </div>
85
81
  <div class='foo'>
86
82
  13
87
83
  </div>
88
- <pre>
89
- __ ______ __ ______&#x000A;.----.| |--.|__ |.----.| |--..--------.| __ |&#x000A;| __|| ||__ || __|| < | || __ |&#x000A;|____||__|__||______||____||__|__||__|__|__||______|&#x000A;
90
- </pre>
91
- <pre>
92
- foo&#x000A;
93
- bar
94
- </pre>
84
+ <pre> __ ______ __ ______&#x000A;.----.| |--.|__ |.----.| |--..--------.| __ |&#x000A;| __|| ||__ || __|| < | || __ |&#x000A;|____||__|__||______||____||__|__||__|__|__||______|</pre>
85
+ <pre>foo
86
+ bar</pre>
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/test_helper'
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
3
  require 'haml/template'
4
4
  require File.dirname(__FILE__) + '/mocks/article'
5
5
 
6
- module TestFilter
6
+ module Haml::Filters::Test
7
7
  include Haml::Filters::Base
8
8
 
9
9
  def render(text)
@@ -11,15 +11,21 @@ module TestFilter
11
11
  end
12
12
  end
13
13
 
14
+ module Haml::Helpers
15
+ def test_partial(name, locals = {})
16
+ Haml::Engine.new(File.read(File.join(TemplateTest::TEMPLATE_PATH, "_#{name}.haml"))).render(self, locals)
17
+ end
18
+ end
19
+
14
20
  class TemplateTest < Test::Unit::TestCase
15
- @@templates = %w{ very_basic standard helpers
21
+ TEMPLATE_PATH = File.join(File.dirname(__FILE__), "templates")
22
+ TEMPLATES = %w{ very_basic standard helpers
16
23
  whitespace_handling original_engine list helpful
17
24
  silent_script tag_parsing just_stuff partials
18
- filters }
25
+ filters nuke_outer_whitespace nuke_inner_whitespace }
19
26
 
20
27
  def setup
21
- Haml::Template.options = { :filters => { 'test'=>TestFilter } }
22
- @base = ActionView::Base.new(File.dirname(__FILE__) + "/templates/", {'article' => Article.new, 'foo' => 'value one'})
28
+ @base = ActionView::Base.new(TEMPLATE_PATH, 'article' => Article.new, 'foo' => 'value one')
23
29
  @base.send(:evaluate_assigns)
24
30
 
25
31
  # This is used by form_for.
@@ -39,20 +45,16 @@ class TemplateTest < Test::Unit::TestCase
39
45
 
40
46
  def assert_renders_correctly(name, &render_method)
41
47
  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
48
+
49
+ load_result(name).split("\n").zip(render_method[name].split("\n")).each_with_index do |pair, line|
50
+ message = "template: #{name}\nline: #{line}"
51
+ assert_equal(pair.first, pair.last, message)
47
52
  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
53
+ rescue ActionView::TemplateError => e
54
+ if e.message =~ /Can't run [\w:]+ filter; required (one of|file) ((?:'\w+'(?: or )?)+)(, but none were found| not found)/
55
+ puts "\nCouldn't require #{$2}; skipping a test."
56
+ else
57
+ raise e
56
58
  end
57
59
  end
58
60
 
@@ -60,30 +62,24 @@ class TemplateTest < Test::Unit::TestCase
60
62
  assert_equal('', render(''))
61
63
  end
62
64
 
63
- def test_templates_should_render_correctly
64
- @@templates.each do |template|
65
+ TEMPLATES.each do |template|
66
+ define_method "test_template_should_render_correctly [template: #{template}] " do
65
67
  assert_renders_correctly template
66
68
  end
67
69
  end
68
70
 
69
71
  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
72
+ assert_renders_correctly("standard") do |name|
73
+ engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"))
74
+ engine.render_proc(@base).call
75
75
  end
76
76
  end
77
-
77
+
78
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
79
+ assert_renders_correctly("standard") do |name|
80
+ engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"))
81
+ engine.def_method(@base, "render_standard")
82
+ @base.render_standard
87
83
  end
88
84
  end
89
85
 
@@ -115,19 +111,6 @@ class TemplateTest < Test::Unit::TestCase
115
111
  assert_equal("2\n", render("= 1+1"))
116
112
  end
117
113
 
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
114
  def test_haml_options
132
115
  Haml::Template.options = { :suppress_eval => true }
133
116
  assert_equal({ :suppress_eval => true }, Haml::Template.options)
@@ -68,6 +68,14 @@
68
68
 
69
69
  .res= res
70
70
 
71
+ %p
72
+ :textile
73
+ I like preserved text:
74
+
75
+ Foo
76
+ #{"Bar"}!
77
+ Baz
78
+
71
79
  :markdown
72
80
  * Foo
73
81
  * Bar
@@ -79,3 +87,8 @@
79
87
  :ruby
80
88
  printf "%s, World!\n", var
81
89
  print "How are you doing today?\n"
90
+
91
+ :escaped
92
+ <div class="foo">
93
+ <p>I think &mdash; or do I?</p>
94
+ </div>