Skip to content

Commit

Permalink
Fix for ActiveSupport::SafeBuffer#gsub issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dtaniwaki committed Jul 1, 2014
1 parent abae793 commit a50b6e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rack/dev-mark/theme/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ def stylesheet_link_tag(path)
end

def gsub_tag_content(html, name, &block)
html.gsub(%r{(<#{name}\s*[^>]*>)([^<]*)(</#{name}>)}i) do
String.new(html).gsub(%r{(<#{name}\s*[^>]*>)([^<]*)(</#{name}>)}i) do
"#{$1}#{block.call($2)}#{$3}"
end
end

def gsub_tag_attribute(html, name, attr, &block)
html.gsub %r{(<#{name}\s*)([^>]*)(>)}i do
String.new(html).gsub %r{(<#{name}\s*)([^>]*)(>)}i do
s1, s2, s3 = $1, $2, $3
s2.gsub! %r{(#{attr}=')([^']*)(')} do
"#{$1}#{block.call($2)}#{$3}"
Expand Down

0 comments on commit a50b6e5

Please sign in to comment.