Permalink
Browse files

in textile extensions, simplify regexp literal, and remove spurious e…

…xtra newline in code blocks
  • Loading branch information...
1 parent da5549b commit 5257ea7f4469bf7f50c86bcfbf8bf13390495177 @fxn fxn committed Feb 28, 2009
Showing with 2 additions and 2 deletions.
  1. +2 −2 railties/guides/rails_guides/textile_extensions.rb
@@ -31,10 +31,10 @@ def plusplus(body)
end
def code(body)
- body.gsub!(/\<(yaml|shell|ruby|erb|html|sql)\>(.*?)\<\/\1\>/m) do |m|
+ body.gsub!(%r{<(yaml|shell|ruby|erb|html|sql)>(.*?)</\1>}m) do |m|
es = ERB::Util.h($2)
css_class = ['erb', 'shell'].include?($1) ? 'html' : $1
- %{<notextile><div class="code_container"><code class="#{css_class}">#{es}\n</code></div></notextile>}
+ %{<notextile><div class="code_container"><code class="#{css_class}">#{es}</code></div></notextile>}
end
end
end

0 comments on commit 5257ea7

Please sign in to comment.