aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/rails_guides/generator.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2009-10-10 23:29:12 +0200
committerXavier Noria <fxn@hashref.com>2009-10-10 23:29:12 +0200
commit326829633cb820cad77be5400939b9a853c42337 (patch)
tree93f72a3c841a9491e0472256c90c684bd75ae7f0 /railties/guides/rails_guides/generator.rb
parent8fcf2347b254dda3c4b6200c60264cfab7012afe (diff)
downloadrails-326829633cb820cad77be5400939b9a853c42337.tar.gz
rails-326829633cb820cad77be5400939b9a853c42337.tar.bz2
rails-326829633cb820cad77be5400939b9a853c42337.zip
trust generated HTML, and define html_safe! for gem >= 2.3 just in case by now
Diffstat (limited to 'railties/guides/rails_guides/generator.rb')
-rw-r--r--railties/guides/rails_guides/generator.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb
index 48714d5208..d4796b65c1 100644
--- a/railties/guides/rails_guides/generator.rb
+++ b/railties/guides/rails_guides/generator.rb
@@ -1,5 +1,11 @@
require 'set'
+class String
+ def html_safe!
+ self
+ end unless "post 9415935902f120a9bac0bfce7129725a0db38ed3".respond_to?(:html_safe!)
+end
+
module RailsGuides
class Generator
attr_reader :output, :view_path, :view, :guides_dir
@@ -55,7 +61,7 @@ module RailsGuides
body = set_header_section(body, @view)
body = set_index(body, @view)
- result = view.render(:layout => 'layout', :text => textile(body))
+ result = view.render(:layout => 'layout', :text => textile(body).html_safe!)
f.write result
warn_about_broken_links(result) if ENV.key?("WARN_BROKEN_LINKS")
end
@@ -71,8 +77,8 @@ module RailsGuides
header = textile(header)
- view.content_for(:page_title) { page_title }
- view.content_for(:header_section) { header }
+ view.content_for(:page_title) { page_title.html_safe! }
+ view.content_for(:header_section) { header.html_safe! }
new_body
end
@@ -103,7 +109,7 @@ module RailsGuides
index << '</ol>'
index << '</div>'
- view.content_for(:index_section) { index }
+ view.content_for(:index_section) { index.html_safe! }
i.result
end