diff options
author | Xavier Noria <fxn@hashref.com> | 2009-02-28 14:26:30 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2009-02-28 14:26:30 +0100 |
commit | 5257ea7f4469bf7f50c86bcfbf8bf13390495177 (patch) | |
tree | c1fcd60c4f901a34eda92180338293aaeb8b0372 /railties | |
parent | da5549b83fe7bf2c36e695e570a12d2fc9e8bbbd (diff) | |
download | rails-5257ea7f4469bf7f50c86bcfbf8bf13390495177.tar.gz rails-5257ea7f4469bf7f50c86bcfbf8bf13390495177.tar.bz2 rails-5257ea7f4469bf7f50c86bcfbf8bf13390495177.zip |
in textile extensions, simplify regexp literal, and remove spurious extra newline in code blocks
Diffstat (limited to 'railties')
-rw-r--r-- | railties/guides/rails_guides/textile_extensions.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/guides/rails_guides/textile_extensions.rb b/railties/guides/rails_guides/textile_extensions.rb index 460dab18c3..794083b44b 100644 --- a/railties/guides/rails_guides/textile_extensions.rb +++ b/railties/guides/rails_guides/textile_extensions.rb @@ -31,10 +31,10 @@ module RailsGuides 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 |