diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-07-25 17:37:01 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-07-25 17:37:01 +0530 |
commit | 60c505dc796dddccf83c0e8d7938c1360df42d9b (patch) | |
tree | 8059bccc8ffda1bbfea8935435ffb1c05d2ce2f0 /railties | |
parent | f330e6af34dfbbe18834009422ba003d23eb96eb (diff) | |
download | rails-60c505dc796dddccf83c0e8d7938c1360df42d9b.tar.gz rails-60c505dc796dddccf83c0e8d7938c1360df42d9b.tar.bz2 rails-60c505dc796dddccf83c0e8d7938c1360df42d9b.zip |
Revert "Update the TIP formatter to handle multiline tips"
This reverts commit e3dbe66e196069fde7d3ff118bd25a03184915fa.
Reason: Code changes are not allowed in docrails.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/guides/rails_guides/textile_extensions.rb | 3 | ||||
-rw-r--r-- | railties/test/guides/textile_extionsions_test.rb | 37 |
2 files changed, 1 insertions, 39 deletions
diff --git a/railties/guides/rails_guides/textile_extensions.rb b/railties/guides/rails_guides/textile_extensions.rb index 0887ebf76b..352c5e91dd 100644 --- a/railties/guides/rails_guides/textile_extensions.rb +++ b/railties/guides/rails_guides/textile_extensions.rb @@ -15,11 +15,10 @@ module RailsGuides end def tip(body) - body.gsub!(/^TIP[.:](.*?)(\n\Z|\n\n+|\Z)/m) do |m| + body.gsub!(/^TIP[.:](.*)$/) do |m| result = "<div class='info'><p>" result << $1.strip result << '</p></div>' - result << $2 if $2 result end end diff --git a/railties/test/guides/textile_extionsions_test.rb b/railties/test/guides/textile_extionsions_test.rb deleted file mode 100644 index 9f1068d9be..0000000000 --- a/railties/test/guides/textile_extionsions_test.rb +++ /dev/null @@ -1,37 +0,0 @@ -require 'isolation/abstract_unit' -require 'guides/rails_guides/textile_extensions' - -class TextileExtensionsTest < Test::Unit::TestCase - include ActiveSupport::Testing::Isolation - include RailsGuides::TextileExtensions - - test "tips can handle a single line" do - expected_output = "<div class='info'><p>this is a single line tip</p></div>" - assert_equal expected_output, tip('TIP. this is a single line tip') - end - - def setup - @multi_line_tip = "This is a multi-line tip.\n" + - "Isn't it fantastic?" - end - - test "tips can handle a multi-line tip" do - expected_output = "<div class='info'><p>#{@multi_line_tip}</p></div>" - - assert_equal expected_output, tip("TIP. #{@multi_line_tip}") - end - - test "muli-line tips handles text before and after the tip" do - pre_line = "This is text before hand.\n\n" - post_line = "\n\nThis is some text after" - input_text = pre_line + - "TIP. #{@multi_line_tip}" + - post_line - - expected_output = pre_line + - "<div class='info'><p>#{@multi_line_tip}</p></div>" + - post_line - - assert_equal expected_output, tip(input_text) - end -end
\ No newline at end of file |