aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/rails_guides/generator.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2009-03-02 01:06:54 +0100
committerXavier Noria <fxn@hashref.com>2009-03-02 01:06:54 +0100
commiteb472d6d21a7f29d381e5df0c8d5163d5da778c6 (patch)
tree02f00fbba6bc67f374cf75946c51875cbab0d2f6 /railties/guides/rails_guides/generator.rb
parentf6fbdf39d732961bcbbddab49ee51bb13b842dd2 (diff)
downloadrails-eb472d6d21a7f29d381e5df0c8d5163d5da778c6.tar.gz
rails-eb472d6d21a7f29d381e5df0c8d5163d5da778c6.tar.bz2
rails-eb472d6d21a7f29d381e5df0c8d5163d5da778c6.zip
do not assume code blocks have blank lines around, also nontextile -> notextile
Diffstat (limited to 'railties/guides/rails_guides/generator.rb')
-rw-r--r--railties/guides/rails_guides/generator.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb
index 18fdb81810..dd147c4d5f 100644
--- a/railties/guides/rails_guides/generator.rb
+++ b/railties/guides/rails_guides/generator.rb
@@ -109,8 +109,8 @@ module RailsGuides
end
def textile(body)
- # If the issue with nontextile is fixed just remove the wrapper.
- with_workaround_for_nontextile(body) do |body|
+ # If the issue with notextile is fixed just remove the wrapper.
+ with_workaround_for_notextile(body) do |body|
t = RedCloth.new(body)
t.hard_breaks = false
t.to_html(:notestuff, :plusplus, :code, :tip)
@@ -120,18 +120,18 @@ module RailsGuides
# For some reason the notextile tag does not always turn off textile. See
# LH ticket of the security guide (#7). As a temporary workaround we deal
# with code blocks by hand.
- def with_workaround_for_nontextile(body)
+ def with_workaround_for_notextile(body)
code_blocks = []
body.gsub!(%r{<(yaml|shell|ruby|erb|html|sql|plain)>(.*?)</\1>}m) do |m|
es = ERB::Util.h($2)
css_class = ['erb', 'shell'].include?($1) ? 'html' : $1
code_blocks << %{<div class="code_container"><code class="#{css_class}">#{es}</code></div>}
- "dirty_workaround_for_nontextile_#{code_blocks.size - 1}"
+ "\ndirty_workaround_for_notextile_#{code_blocks.size - 1}\n"
end
body = yield body
- body.gsub(%r{<p>dirty_workaround_for_nontextile_(\d+)</p>}) do |_|
+ body.gsub(%r{<p>dirty_workaround_for_notextile_(\d+)</p>}) do |_|
code_blocks[$1.to_i]
end
end