diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2012-12-03 10:30:58 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2012-12-03 10:32:23 -0700 |
commit | 9d6e502f81bcf56c7da8a7d1f9e433b4e0a7e3e9 (patch) | |
tree | 3ba56af433cd5294e0b8d2ec392a2054f588a4ff /actionpack/lib/action_view/template/handlers | |
parent | 19599c274404169d5c75355a7b5a7f39795b4373 (diff) | |
download | rails-9d6e502f81bcf56c7da8a7d1f9e433b4e0a7e3e9.tar.gz rails-9d6e502f81bcf56c7da8a7d1f9e433b4e0a7e3e9.tar.bz2 rails-9d6e502f81bcf56c7da8a7d1f9e433b4e0a7e3e9.zip |
Override <%== to always behave as literal text rather than toggling based on whether escaping is enabled. Fixes that existing plaintext email templates using <%== unexpectedly flipped to *escaping* HTML when #8235 was merged.
Conflicts:
actionpack/test/template/template_test.rb
Diffstat (limited to 'actionpack/lib/action_view/template/handlers')
-rw-r--r-- | actionpack/lib/action_view/template/handlers/erb.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/template/handlers/erb.rb b/actionpack/lib/action_view/template/handlers/erb.rb index 6cc6a8f8ed..118b18a81c 100644 --- a/actionpack/lib/action_view/template/handlers/erb.rb +++ b/actionpack/lib/action_view/template/handlers/erb.rb @@ -15,6 +15,17 @@ module ActionView src << "@output_buffer.safe_concat('" << escape_text(text) << "');" end + # Erubis toggles <%= and <%== behavior when escaping is enabled. + # We override to always treat <%== as escaped. + def add_expr(src, code, indicator) + case indicator + when '==' + add_expr_escaped(src, code) + else + super + end + end + BLOCK_EXPR = /\s+(do|\{)(\s*\|[^|]*\|)?\s*\Z/ def add_expr_literal(src, code) |