aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/CHANGELOG4
-rw-r--r--actionpack/lib/action_view/vendor/builder/xmlmarkup.rb11
2 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 59fdffbcfa..5c1a8f460e 100644
--- a/actionpack/CHANGELOG
+++ b/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]
diff --git a/actionpack/lib/action_view/vendor/builder/xmlmarkup.rb b/actionpack/lib/action_view/vendor/builder/xmlmarkup.rb
index 4f82704c20..b7e3b2d009 100644
--- a/actionpack/lib/action_view/vendor/builder/xmlmarkup.rb
+++ b/actionpack/lib/action_view/vendor/builder/xmlmarkup.rb
@@ -239,6 +239,17 @@ module Builder
[: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