From f3d4bfe83b7d1b478204351963d1717ebd6b7470 Mon Sep 17 00:00:00 2001 From: nex3 Date: Wed, 5 Sep 2007 19:38:09 +0000 Subject: [PATCH] Cleaning up the find_and_preserve code. git-svn-id: svn://hamptoncatlin.com/haml/trunk@601 7063305b-7217-0410-af8c-cdc13e5119b9 --- lib/haml/helpers.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/haml/helpers.rb b/lib/haml/helpers.rb index e6080f1d..5ed65b6e 100644 --- a/lib/haml/helpers.rb +++ b/lib/haml/helpers.rb @@ -46,10 +46,9 @@ module Haml # to convert any endlines inside them into HTML entities for endlines. def find_and_preserve(input) input = input.to_s - input.scan(/<(textarea|code|pre)[^>]*>(.*?)<\/\1>/im) do |tag, contents| - input = input.gsub(contents, preserve(contents)) + input.gsub(/<(textarea|code|pre)([^>]*)>(.*?)(<\/\1>)/im) do + "<#{$1}#{$2}>#{preserve($3)}" end - input end # Takes any string, finds all the endlines and converts them to