mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Cleaning up the find_and_preserve code.
git-svn-id: svn://hamptoncatlin.com/haml/trunk@601 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
parent
b0b52623b6
commit
f3d4bfe83b
1 changed files with 2 additions and 3 deletions
|
@ -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)}</#{$1}>"
|
||||
end
|
||||
input
|
||||
end
|
||||
|
||||
# Takes any string, finds all the endlines and converts them to
|
||||
|
|
Loading…
Add table
Reference in a new issue