mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
in textile extensions, simplify regexp literal, and remove spurious extra newline in code blocks
This commit is contained in:
parent
da5549b83f
commit
5257ea7f44
1 changed files with 2 additions and 2 deletions
|
@ -31,10 +31,10 @@ module RailsGuides
|
||||||
end
|
end
|
||||||
|
|
||||||
def code(body)
|
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)
|
es = ERB::Util.h($2)
|
||||||
css_class = ['erb', 'shell'].include?($1) ? 'html' : $1
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue