Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adds the ability to include XML CDATA tags using Builder #1563 [Josh …

…Knowles]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1598 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit bf9b90a908235c9d0ce0c0466e3808619803bad8 1 parent 2f61c43
@dhh dhh authored
View
4 actionpack/CHANGELOG
@@ -1,5 +1,9 @@
*SVN*
+* Adds the ability to include XML CDATA tags using Builder #1563 [Josh Knowles]. Example:
+
+ xml.cdata! "some text" # => <![CDATA[some text]]>
+
* Added evaluation of <SCRIPT> blocks in content returned to Ajax calls #1577 [Thomas Fuchs/court3nay]
* Directly generate paths with a leading slash instead of tacking it on later. #1543 [Nicholas Seckar]
View
11 actionpack/lib/action_view/vendor/builder/xmlmarkup.rb
@@ -239,6 +239,17 @@ def instruct!(directive_tag=:xml, attrs={})
[:version, :encoding, :standalone])
end
+ # Surrounds the given text with a CDATA tag
+ #
+ # For example:
+ #
+ # xml.cdata! "blah blah blah"
+ # # => <![CDATA[blah blah blah]]>
+ def cdata!(text)
+ _ensure_no_block block_given?
+ _special("<![CDATA[", "]]>", text, nil)
+ end
+
private
# NOTE: All private methods of a builder object are prefixed when
Please sign in to comment.
Something went wrong with that request. Please try again.