diff options
author | Sergey Nartimov <just.lest@gmail.com> | 2012-04-30 16:08:06 +0300 |
---|---|---|
committer | Sergey Nartimov <just.lest@gmail.com> | 2012-04-30 16:08:06 +0300 |
commit | 16df67b1486d0651494a27d77f8e0469f4f1563f (patch) | |
tree | 75211ebc0575d8f03b0e017f881cd89512c00535 /actionpack/lib/action_view | |
parent | 02741121be86e2e5a83f10e8dc15be6700c62de4 (diff) | |
download | rails-16df67b1486d0651494a27d77f8e0469f4f1563f.tar.gz rails-16df67b1486d0651494a27d77f8e0469f4f1563f.tar.bz2 rails-16df67b1486d0651494a27d77f8e0469f4f1563f.zip |
split CDATA end token in cdata_section helper
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/tag_helper.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb index 23777721f6..f7afa48256 100644 --- a/actionpack/lib/action_view/helpers/tag_helper.rb +++ b/actionpack/lib/action_view/helpers/tag_helper.rb @@ -109,8 +109,12 @@ module ActionView # # cdata_section(File.read("hello_world.txt")) # # => <![CDATA[<hello from a text file]]> + # + # cdata_section("hello]]>world") + # # => <![CDATA[hello]]]]><![CDATA[>world]]> def cdata_section(content) - "<![CDATA[#{content}]]>".html_safe + splitted = content.gsub(']]>', ']]]]><![CDATA[>') + "<![CDATA[#{splitted}]]>".html_safe end # Returns an escaped version of +html+ without affecting existing escaped entities. |