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.
- data/CHANGELOG +35 -3
- data/CONTRIBUTORS +11 -1
- data/README +5 -3
- data/app/controllers/admin/welcome_controller.rb +7 -0
- data/app/migrate/020_add_session_info_to_users.rb +11 -0
- data/app/models/page.rb +22 -9
- data/app/models/standard_tags.rb +133 -10
- data/app/models/user.rb +9 -1
- data/app/views/admin/page/edit.html.haml +5 -4
- data/app/views/admin/welcome/login.html.haml +42 -24
- data/app/views/layouts/application.html.haml +1 -1
- data/config/environment.rb +4 -2
- data/db/migrate/020_add_session_info_to_users.rb +11 -0
- data/db/migrate/021_remove_session_expire_from_users.rb +9 -0
- data/db/schema.rb +3 -2
- data/lib/generators/instance/instance_generator.rb +2 -1
- data/lib/generators/instance/templates/instance_environment.rb +5 -3
- data/lib/login_system.rb +13 -0
- data/lib/radiant.rb +1 -1
- data/lib/radiant/admin_ui.rb +21 -21
- data/lib/radiant/extension/script.rb +251 -0
- data/lib/radiant/extension_loader.rb +22 -20
- data/lib/radiant/initializer.rb +1 -1
- data/lib/radiant/setup.rb +2 -0
- data/lib/tasks/framework.rake +39 -29
- data/public/500.html +1 -1
- data/public/javascripts/admin/admin.js +11 -9
- data/script/extension +5 -0
- data/spec/controllers/admin/user_controller_spec.rb +1 -1
- data/spec/controllers/admin/welcome_controller_spec.rb +31 -5
- data/spec/controllers/site_controller_spec.rb +15 -2
- data/spec/lib/login_system_spec.rb +106 -60
- data/spec/lib/radiant/extension/script_spec.rb +349 -0
- data/spec/lib/radiant/extension_loader_spec.rb +3 -0
- data/spec/models/page_spec.rb +62 -2
- data/spec/models/standard_tags_spec.rb +150 -3
- data/spec/models/user_spec.rb +28 -0
- data/spec/scenarios/file_not_found_scenario.rb +5 -0
- data/spec/scenarios/pages_scenario.rb +6 -0
- data/spec/scenarios/snippets_scenario.rb +4 -0
- data/test/fixtures/users.yml +11 -6
- data/vendor/plugins/haml/FAQ +138 -0
- data/vendor/plugins/haml/REVISION +1 -0
- data/vendor/plugins/haml/Rakefile +54 -62
- data/vendor/plugins/haml/VERSION +1 -1
- data/vendor/plugins/haml/init.rb +6 -1
- data/vendor/plugins/haml/lib/haml.rb +72 -12
- data/vendor/plugins/haml/lib/haml/buffer.rb +47 -40
- data/vendor/plugins/haml/lib/haml/engine.rb +20 -30
- data/vendor/plugins/haml/lib/haml/error.rb +4 -5
- data/vendor/plugins/haml/lib/haml/exec.rb +4 -2
- data/vendor/plugins/haml/lib/haml/filters.rb +30 -15
- data/vendor/plugins/haml/lib/haml/helpers.rb +47 -28
- data/vendor/plugins/haml/lib/haml/helpers/action_view_mods.rb +74 -25
- data/vendor/plugins/haml/lib/haml/precompiler.rb +92 -51
- data/vendor/plugins/haml/lib/haml/template.rb +11 -3
- data/vendor/plugins/haml/lib/haml/template/patch.rb +1 -1
- data/vendor/plugins/haml/lib/sass.rb +26 -3
- data/vendor/plugins/haml/lib/sass/constant.rb +26 -57
- data/vendor/plugins/haml/lib/sass/constant/literal.rb +1 -0
- data/vendor/plugins/haml/lib/sass/constant/nil.rb +9 -0
- data/vendor/plugins/haml/lib/sass/css.rb +17 -2
- data/vendor/plugins/haml/lib/sass/engine.rb +11 -5
- data/vendor/plugins/haml/test/haml/engine_test.rb +57 -39
- data/vendor/plugins/haml/test/haml/helper_test.rb +20 -4
- data/vendor/plugins/haml/test/haml/html2haml_test.rb +1 -3
- data/vendor/plugins/haml/test/haml/results/content_for_layout.xhtml +1 -2
- data/vendor/plugins/haml/test/haml/results/eval_suppressed.xhtml +2 -4
- data/vendor/plugins/haml/test/haml/results/filters.xhtml +12 -8
- data/vendor/plugins/haml/test/haml/results/helpers.xhtml +2 -5
- data/vendor/plugins/haml/test/haml/results/just_stuff.xhtml +1 -3
- data/vendor/plugins/haml/test/haml/results/nuke_inner_whitespace.xhtml +40 -0
- data/vendor/plugins/haml/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
- data/vendor/plugins/haml/test/haml/results/original_engine.xhtml +2 -4
- data/vendor/plugins/haml/test/haml/results/tag_parsing.xhtml +1 -6
- data/vendor/plugins/haml/test/haml/results/very_basic.xhtml +2 -4
- data/vendor/plugins/haml/test/haml/results/whitespace_handling.xhtml +13 -21
- data/vendor/plugins/haml/test/haml/template_test.rb +31 -48
- data/vendor/plugins/haml/test/haml/templates/filters.haml +13 -0
- data/vendor/plugins/haml/test/haml/templates/helpers.haml +1 -1
- data/vendor/plugins/haml/test/haml/templates/just_stuff.haml +0 -1
- data/vendor/plugins/haml/test/haml/templates/nuke_inner_whitespace.haml +32 -0
- data/vendor/plugins/haml/test/haml/templates/nuke_outer_whitespace.haml +144 -0
- data/vendor/plugins/haml/test/haml/templates/partials.haml +1 -1
- data/vendor/plugins/haml/test/haml/templates/tag_parsing.haml +0 -3
- data/vendor/plugins/haml/test/haml/templates/whitespace_handling.haml +10 -10
- data/vendor/plugins/haml/test/sass/engine_test.rb +11 -5
- data/vendor/plugins/haml/test/sass/plugin_test.rb +2 -6
- data/vendor/plugins/haml/test/sass/results/constants.css +2 -0
- data/vendor/plugins/haml/test/sass/templates/constants.sass +3 -0
- data/vendor/plugins/haml/test/{haml/test_helper.rb → test_helper.rb} +4 -3
- metadata +21 -11
- data/vendor/plugins/haml/TODO +0 -9
- data/vendor/plugins/haml/extra/haml-mode.el +0 -328
- data/vendor/plugins/haml/extra/sass-mode.el +0 -88
- data/vendor/plugins/haml/test/profile.rb +0 -65
@@ -4,6 +4,7 @@ module Sass::Constant; class Literal; end; end; # :nodoc:
|
|
4
4
|
require 'sass/constant/string'
|
5
5
|
require 'sass/constant/number'
|
6
6
|
require 'sass/constant/color'
|
7
|
+
require 'sass/constant/nil'
|
7
8
|
|
8
9
|
class Sass::Constant::Literal # :nodoc:
|
9
10
|
# The regular expression matching numbers.
|
@@ -46,25 +46,40 @@ module Sass
|
|
46
46
|
# It keeps the semantics and most of the efficiency of normal hashes
|
47
47
|
# while also keeping track of the order in which elements were set.
|
48
48
|
class OrderedHash
|
49
|
-
Node = Struct.new(
|
49
|
+
Node = Struct.new(:key, :value, :next, :prev)
|
50
50
|
include Enumerable
|
51
51
|
|
52
52
|
def initialize
|
53
53
|
@hash = {}
|
54
54
|
end
|
55
55
|
|
56
|
+
def initialize_copy(other)
|
57
|
+
@hash = other.instance_variable_get('@hash').clone
|
58
|
+
end
|
59
|
+
|
56
60
|
def [](key)
|
57
61
|
@hash[key] && @hash[key].value
|
58
62
|
end
|
59
63
|
|
60
64
|
def []=(key, value)
|
61
|
-
node = Node.new(key, value
|
65
|
+
node = Node.new(key, value)
|
66
|
+
|
67
|
+
if old = @hash[key]
|
68
|
+
if old.prev
|
69
|
+
old.prev.next = old.next
|
70
|
+
else # old is @first and @last
|
71
|
+
@first = @last = nil
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
62
75
|
if @first.nil?
|
63
76
|
@first = @last = node
|
64
77
|
else
|
78
|
+
node.prev = @last
|
65
79
|
@last.next = node
|
66
80
|
@last = node
|
67
81
|
end
|
82
|
+
|
68
83
|
@hash[key] = node
|
69
84
|
value
|
70
85
|
end
|
@@ -76,7 +76,7 @@ module Sass
|
|
76
76
|
:style => :nested,
|
77
77
|
:load_paths => ['.']
|
78
78
|
}.merge! options
|
79
|
-
@template = template.split(/\n
|
79
|
+
@template = template.split(/\r\n|\r|\n/)
|
80
80
|
@lines = []
|
81
81
|
@constants = {"important" => "!important"}
|
82
82
|
@mixins = {}
|
@@ -134,7 +134,7 @@ module Sass
|
|
134
134
|
# and computes the tabulation of the line.
|
135
135
|
def split_lines
|
136
136
|
@line = 0
|
137
|
-
old_tabs =
|
137
|
+
old_tabs = nil
|
138
138
|
@template.each_with_index do |line, index|
|
139
139
|
@line += 1
|
140
140
|
|
@@ -145,14 +145,16 @@ module Sass
|
|
145
145
|
end
|
146
146
|
|
147
147
|
if tabs # if line isn't blank
|
148
|
-
|
148
|
+
raise SyntaxError.new("Indenting at the beginning of the document is illegal.", @line) if old_tabs.nil? && tabs > 0
|
149
|
+
|
150
|
+
if old_tabs && tabs - old_tabs > 1
|
149
151
|
raise SyntaxError.new("#{tabs * 2} spaces were used for indentation. Sass must be indented using two spaces.", @line)
|
150
152
|
end
|
151
153
|
@lines << [line.strip, tabs]
|
152
154
|
|
153
155
|
old_tabs = tabs
|
154
156
|
else
|
155
|
-
@lines << ['//', old_tabs]
|
157
|
+
@lines << ['//', old_tabs || 0]
|
156
158
|
end
|
157
159
|
end
|
158
160
|
|
@@ -287,7 +289,11 @@ END
|
|
287
289
|
when MIXIN_DEFINITION_CHAR
|
288
290
|
parse_mixin_definition(line)
|
289
291
|
when MIXIN_INCLUDE_CHAR
|
290
|
-
|
292
|
+
if line[1].nil? || line[1] == ?\s
|
293
|
+
Tree::RuleNode.new(line, @options[:style])
|
294
|
+
else
|
295
|
+
parse_mixin_include(line)
|
296
|
+
end
|
291
297
|
else
|
292
298
|
if line =~ ATTRIBUTE_ALTERNATE_MATCHER
|
293
299
|
parse_attribute(line, ATTRIBUTE_ALTERNATE)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require File.dirname(__FILE__) + '
|
2
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
3
3
|
|
4
4
|
class EngineTest < Test::Unit::TestCase
|
5
5
|
# A map of erroneous Sass documents to the error messages they should produce.
|
@@ -32,11 +32,23 @@ END
|
|
32
32
|
".= a" => "Illegal element: classes and ids must have values.",
|
33
33
|
"%p..a" => "Illegal element: classes and ids must have values.",
|
34
34
|
"%a/ b" => "Self-closing tags can't have content.",
|
35
|
+
" %p foo" => "Indenting at the beginning of the document is illegal.",
|
36
|
+
" %p foo" => "Indenting at the beginning of the document is illegal.",
|
37
|
+
" \n\t\n %p foo" => ["Indenting at the beginning of the document is illegal.", 3],
|
35
38
|
|
36
39
|
# Regression tests
|
37
40
|
"- raise 'foo'\n\n\n\nbar" => ["foo", 1],
|
38
41
|
"= 'foo'\n-raise 'foo'" => ["foo", 2],
|
39
42
|
"\n\n\n- raise 'foo'" => ["foo", 4],
|
43
|
+
"foo\n\n\n bar" => ["Illegal nesting: nesting within plain text is illegal.", 4],
|
44
|
+
"%p/\n\n bar" => ["Illegal nesting: nesting within a self-closing tag is illegal.", 3],
|
45
|
+
"%p foo\n\n bar" => ["Illegal nesting: content can't be both given on the same line as %p and nested within it.", 3],
|
46
|
+
"/ foo\n\n bar" => ["Illegal nesting: nesting within a tag that already has content is illegal.", 3],
|
47
|
+
"!!!\n\n bar" => ["Illegal nesting: nesting within a header command is illegal.", 3],
|
48
|
+
"foo\n\n\n\tbar" => [<<END.strip, 4],
|
49
|
+
A tab character was used for indentation. Haml must be indented using two spaces.
|
50
|
+
Are you sure you have soft tabs enabled in your editor?
|
51
|
+
END
|
40
52
|
}
|
41
53
|
|
42
54
|
User = Struct.new('User', :id)
|
@@ -52,7 +64,7 @@ END
|
|
52
64
|
end
|
53
65
|
|
54
66
|
def test_attributes_should_render_correctly
|
55
|
-
assert_equal("<div class='atlantis' style='ugly'
|
67
|
+
assert_equal("<div class='atlantis' style='ugly'></div>", render(".atlantis{:style => 'ugly'}").chomp)
|
56
68
|
end
|
57
69
|
|
58
70
|
def test_ruby_code_should_work_inside_attributes
|
@@ -61,7 +73,7 @@ END
|
|
61
73
|
end
|
62
74
|
|
63
75
|
def test_nil_should_render_empty_tag
|
64
|
-
assert_equal("<div class='no_attributes'
|
76
|
+
assert_equal("<div class='no_attributes'></div>",
|
65
77
|
render(".no_attributes{:nil => nil}").chomp)
|
66
78
|
end
|
67
79
|
|
@@ -128,20 +140,38 @@ END
|
|
128
140
|
|
129
141
|
assert_equal("<textarea>#{'a' * 100}</textarea>\n",
|
130
142
|
render("%textarea #{'a' * 100}"))
|
143
|
+
|
144
|
+
assert_equal("<p>\n <textarea>Foo\n Bar\n Baz</textarea>\n</p>\n", render(<<SOURCE))
|
145
|
+
%p
|
146
|
+
%textarea
|
147
|
+
Foo
|
148
|
+
Bar
|
149
|
+
Baz
|
150
|
+
SOURCE
|
131
151
|
end
|
132
152
|
|
133
153
|
def test_boolean_attributes
|
134
|
-
assert_equal("<p bar baz='true' foo='bar'
|
154
|
+
assert_equal("<p bar baz='true' foo='bar'></p>\n",
|
135
155
|
render("%p{:foo => 'bar', :bar => true, :baz => 'true'}", :format => :html4))
|
136
|
-
assert_equal("<p bar='bar' baz='true' foo='bar'
|
156
|
+
assert_equal("<p bar='bar' baz='true' foo='bar'></p>\n",
|
137
157
|
render("%p{:foo => 'bar', :bar => true, :baz => 'true'}", :format => :xhtml))
|
138
158
|
|
139
|
-
assert_equal("<p baz='false' foo='bar'
|
159
|
+
assert_equal("<p baz='false' foo='bar'></p>\n",
|
140
160
|
render("%p{:foo => 'bar', :bar => false, :baz => 'false'}", :format => :html4))
|
141
|
-
assert_equal("<p baz='false' foo='bar'
|
161
|
+
assert_equal("<p baz='false' foo='bar'></p>\n",
|
142
162
|
render("%p{:foo => 'bar', :bar => false, :baz => 'false'}", :format => :xhtml))
|
143
163
|
end
|
144
164
|
|
165
|
+
def test_both_whitespace_nukes_work_together
|
166
|
+
assert_equal(<<RESULT, render(<<SOURCE))
|
167
|
+
<p><q>Foo
|
168
|
+
Bar</q></p>
|
169
|
+
RESULT
|
170
|
+
%p
|
171
|
+
%q><= "Foo\\nBar"
|
172
|
+
SOURCE
|
173
|
+
end
|
174
|
+
|
145
175
|
# HTML escaping tests
|
146
176
|
|
147
177
|
def test_ampersand_equals_should_escape
|
@@ -241,29 +271,22 @@ END
|
|
241
271
|
assert_equal("<div id='foo' yes='no' />\n", render("#foo{:yes => 'no'}/", :suppress_eval => true))
|
242
272
|
assert_equal("<div id='foo' />\n", render("#foo{:yes => 'no', :call => a_function() }/", :suppress_eval => true))
|
243
273
|
assert_equal("<div />\n", render("%div[1]/", :suppress_eval => true))
|
244
|
-
|
245
|
-
begin
|
246
|
-
assert_equal("", render(":ruby\n puts 'hello'", :suppress_eval => true))
|
247
|
-
rescue Haml::Error => err
|
248
|
-
caught = true
|
249
|
-
assert_equal('Filter "ruby" is not defined.', err.message)
|
250
|
-
end
|
251
|
-
assert(caught, "Rendering a ruby filter without evaluating didn't throw an error!")
|
274
|
+
assert_equal("", render(":ruby\n puts 'hello'", :suppress_eval => true))
|
252
275
|
end
|
253
276
|
|
254
277
|
def test_attr_wrapper
|
255
|
-
assert_equal("<p strange=*attrs
|
256
|
-
assert_equal("<p escaped='quo\"te'
|
257
|
-
assert_equal("<p escaped=\"quo'te\"
|
258
|
-
assert_equal("<p escaped=\"q'uo"te\"
|
278
|
+
assert_equal("<p strange=*attrs*></p>\n", render("%p{ :strange => 'attrs'}", :attr_wrapper => '*'))
|
279
|
+
assert_equal("<p escaped='quo\"te'></p>\n", render("%p{ :escaped => 'quo\"te'}", :attr_wrapper => '"'))
|
280
|
+
assert_equal("<p escaped=\"quo'te\"></p>\n", render("%p{ :escaped => 'quo\\'te'}", :attr_wrapper => '"'))
|
281
|
+
assert_equal("<p escaped=\"q'uo"te\"></p>\n", render("%p{ :escaped => 'q\\'uo\"te'}", :attr_wrapper => '"'))
|
259
282
|
assert_equal("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n", render("!!! XML", :attr_wrapper => '"'))
|
260
283
|
end
|
261
284
|
|
262
285
|
def test_attrs_parsed_correctly
|
263
|
-
assert_equal("<p boom=>biddly='bar => baz'
|
264
|
-
assert_equal("<p foo,bar='baz, qux'
|
265
|
-
assert_equal("<p escaped='quo\nte'
|
266
|
-
assert_equal("<p escaped='quo4te'
|
286
|
+
assert_equal("<p boom=>biddly='bar => baz'></p>\n", render("%p{'boom=>biddly' => 'bar => baz'}"))
|
287
|
+
assert_equal("<p foo,bar='baz, qux'></p>\n", render("%p{'foo,bar' => 'baz, qux'}"))
|
288
|
+
assert_equal("<p escaped='quo\nte'></p>\n", render("%p{ :escaped => \"quo\\nte\"}"))
|
289
|
+
assert_equal("<p escaped='quo4te'></p>\n", render("%p{ :escaped => \"quo\#{2 + 2}te\"}"))
|
267
290
|
end
|
268
291
|
|
269
292
|
def test_correct_parsing_with_brackets
|
@@ -313,21 +336,9 @@ END
|
|
313
336
|
assert_equal("<p>Paragraph!</p>\n", render("%p= text", :locals => { :text => "Paragraph!" }))
|
314
337
|
end
|
315
338
|
|
316
|
-
def test_deprecated_locals_option
|
317
|
-
Kernel.module_eval do
|
318
|
-
def warn_with_stub(msg); end
|
319
|
-
alias_method :warn_without_stub, :warn
|
320
|
-
alias_method :warn, :warn_with_stub
|
321
|
-
end
|
322
|
-
|
323
|
-
assert_equal("<p>Paragraph!</p>\n", Haml::Engine.new("%p= text", :locals => { :text => "Paragraph!" }).render)
|
324
|
-
|
325
|
-
Kernel.module_eval { alias_method :warn, :warn_without_stub }
|
326
|
-
end
|
327
|
-
|
328
339
|
def test_dynamic_attrs_shouldnt_register_as_literal_values
|
329
|
-
assert_equal("<p a='b2c'
|
330
|
-
assert_equal("<p a='b2c'
|
340
|
+
assert_equal("<p a='b2c'></p>\n", render('%p{:a => "b#{1 + 1}c"}'))
|
341
|
+
assert_equal("<p a='b2c'></p>\n", render("%p{:a => 'b' + (1 + 1).to_s + 'c'}"))
|
331
342
|
end
|
332
343
|
|
333
344
|
def test_dynamic_attrs_with_self_closed_tag
|
@@ -542,6 +553,13 @@ END
|
|
542
553
|
render("%p= 's' * 75", :ugly => true))
|
543
554
|
end
|
544
555
|
|
556
|
+
def test_auto_preserve_unless_ugly
|
557
|
+
assert_equal("<pre>foo
bar</pre>\n", render('%pre="foo\nbar"'))
|
558
|
+
assert_equal("<pre>foo\nbar</pre>\n", render("%pre\n foo\n bar"))
|
559
|
+
assert_equal("<pre>foo\nbar</pre>\n", render('%pre="foo\nbar"', :ugly => true))
|
560
|
+
assert_equal("<pre>foo\nbar</pre>\n", render("%pre\n foo\n bar", :ugly => true))
|
561
|
+
end
|
562
|
+
|
545
563
|
def test_xhtml_output_option
|
546
564
|
assert_equal "<p>\n <br />\n</p>\n", render("%p\n %br", :format => :xhtml)
|
547
565
|
assert_equal "<a />\n", render("%a/", :format => :xhtml)
|
@@ -559,11 +577,11 @@ END
|
|
559
577
|
end
|
560
578
|
|
561
579
|
def test_html_renders_empty_node_with_closing_tag
|
562
|
-
assert_equal
|
580
|
+
assert_equal "<div class='foo'></div>\n", render(".foo", :format => :html4)
|
563
581
|
end
|
564
582
|
|
565
583
|
def test_html_ignores_explicit_self_closing_declaration
|
566
|
-
assert_equal "<a
|
584
|
+
assert_equal "<a></a>\n", render("%a/", :format => :html4)
|
567
585
|
end
|
568
586
|
|
569
587
|
def test_html_ignores_xml_prolog_declaration
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require File.dirname(__FILE__) + '
|
2
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
3
3
|
require 'haml/template'
|
4
4
|
|
5
5
|
class HelperTest < Test::Unit::TestCase
|
@@ -105,7 +105,23 @@ class HelperTest < Test::Unit::TestCase
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def test_haml_tag_non_autoclosed_tags_arent_closed
|
108
|
-
assert_equal("<p
|
108
|
+
assert_equal("<p></p>\n", render("- haml_tag :p"))
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_haml_tag_renders_text_on_a_single_line
|
112
|
+
assert_equal("<p>#{'a' * 100}</p>\n", render("- haml_tag :p, 'a' * 100"))
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_haml_tag_raises_error_for_multiple_content
|
116
|
+
assert_raise(Haml::Error) { render("- haml_tag :p, 'foo' do\n bar") }
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_haml_tag_flags
|
120
|
+
assert_equal("<p />\n", render("- haml_tag :p, :/"))
|
121
|
+
assert_equal("<p>kumquat</p>\n", render("- haml_tag :p, :< do\n kumquat"))
|
122
|
+
|
123
|
+
assert_raise(Haml::Error) { render("- haml_tag :p, 'foo', :/") }
|
124
|
+
assert_raise(Haml::Error) { render("- haml_tag :p, :/ do\n foo") }
|
109
125
|
end
|
110
126
|
|
111
127
|
def test_is_haml
|
@@ -141,12 +157,12 @@ class HelperTest < Test::Unit::TestCase
|
|
141
157
|
end
|
142
158
|
|
143
159
|
def test_find_and_preserve_with_block
|
144
|
-
assert_equal("<pre
|
160
|
+
assert_equal("<pre>Foo
Bar</pre>\nFoo\nBar\n",
|
145
161
|
render("= find_and_preserve do\n %pre\n Foo\n Bar\n Foo\n Bar"))
|
146
162
|
end
|
147
163
|
|
148
164
|
def test_preserve_with_block
|
149
|
-
assert_equal("<pre
|
165
|
+
assert_equal("<pre>Foo
Bar</pre>
Foo
Bar\n",
|
150
166
|
render("= preserve do\n %pre\n Foo\n Bar\n Foo\n Bar"))
|
151
167
|
end
|
152
168
|
|
@@ -11,9 +11,7 @@ TESTING HAHAHAHA!
|
|
11
11
|
<h1>Foo</h1>
|
12
12
|
|
13
13
|
|
14
|
-
<pre><code>This is preformatted
|
15
|
-
Look at that!
|
16
|
-
Wowie-zowie!</code></pre>
|
14
|
+
<pre><code>This is preformatted!
Look at that!
Wowie-zowie!</code></pre>
|
17
15
|
|
18
16
|
|
19
17
|
<p><strong>boldilicious!</strong></p>
|
@@ -40,10 +38,8 @@ This
|
|
40
38
|
\#{also not}
|
41
39
|
\\
|
42
40
|
<p>
|
43
|
-
<pre>
|
44
|
-
This
|
45
|
-
This one is, too.
Nested, that is.


|
46
|
-
</pre>
|
41
|
+
<pre>This pre is pretty deeply
 nested.
 Does interpolation work?
|
42
|
+
This one is, too.
Nested, that is.
</pre>
|
47
43
|
</p>
|
48
44
|
<ul>
|
49
45
|
|
@@ -71,6 +67,12 @@ This pre is pretty deeply
 nested.
 Does interpolation work
|
|
71
67
|
|
72
68
|
</ul>
|
73
69
|
<div class='res'>178</div>
|
70
|
+
<p>
|
71
|
+
<p>I like preserved text:</p>
|
72
|
+
|
73
|
+
|
74
|
+
<pre><code>Foo
 Bar!
Baz</code></pre>
|
75
|
+
</p>
|
74
76
|
<ul>
|
75
77
|
<li>Foo</li>
|
76
78
|
<li>Bar</li>
|
@@ -79,4 +81,6 @@ This pre is pretty deeply
 nested.
 Does interpolation work
|
|
79
81
|
Text!
|
80
82
|
Hello, World!
|
81
83
|
How are you doing today?
|
82
|
-
|
84
|
+
<div class="foo">
|
85
|
+
<p>I think &mdash; or do I?</p>
|
86
|
+
</div>
|
@@ -17,7 +17,6 @@ Embedded? one af"t"er another!
|
|
17
17
|
<p>Embedded? true!</p>
|
18
18
|
<p>Embedded? twice! true!</p>
|
19
19
|
<p>Embedded? one af"t"er another!</p>
|
20
|
-
<div class='render'><em>wow!</em></div>
|
21
20
|
stuff followed by whitespace
|
22
21
|
<strong>block with whitespace</strong>
|
23
22
|
<p>
|
@@ -59,6 +58,5 @@ testtest
|
|
59
58
|
<p class='article foo' id='article_1'>Blah</p>
|
60
59
|
<p class='article quux qux' id='article_1'>Blump</p>
|
61
60
|
Woah inner quotes
|
62
|
-
<p class='dynamic_quote' dyn='3' quotes="single '">
|
63
|
-
</p>
|
61
|
+
<p class='dynamic_quote' dyn='3' quotes="single '"></p>
|
64
62
|
<p class='dynamic_self_closing' dyn='3' />
|