diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-17 03:26:20 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-17 03:26:20 +0530 |
commit | dba196cb7f8d34b93f6872e4a43737bb52019065 (patch) | |
tree | 97a2f784a2ec2bfae4f960af56a9280dad6f7774 /railties/guides/rails_guides | |
parent | 6e3bee6cf1f0d2684152292db0a8b757249824fd (diff) | |
download | rails-dba196cb7f8d34b93f6872e4a43737bb52019065.tar.gz rails-dba196cb7f8d34b93f6872e4a43737bb52019065.tar.bz2 rails-dba196cb7f8d34b93f6872e4a43737bb52019065.zip |
Merge docrails
Diffstat (limited to 'railties/guides/rails_guides')
-rw-r--r-- | railties/guides/rails_guides/generator.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb index e3df3be882..bd25111405 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 @@ -18,7 +24,7 @@ module RailsGuides end def generate - guides = Dir.entries(view_path).find_all {|g| g =~ /textile$/ } + guides = Dir.entries(view_path).find_all {|g| g =~ /\.textile(?:\.erb)?$/ } if ENV["ONLY"] only = ENV["ONLY"].split(",").map{|x| x.strip }.map {|o| "#{o}.textile" } @@ -36,7 +42,7 @@ module RailsGuides end def generate_guide(guide) - guide =~ /(.*?)(\.erb)?\.textile/ + guide =~ /(.*?)\.textile(?:\.erb)?$/ name = $1 puts "Generating #{name}" @@ -46,7 +52,7 @@ module RailsGuides @view = ActionView::Base.new(view_path) @view.extend(Helpers) - if guide =~ /\.erb\.textile/ + if guide =~ /\.textile\.erb$/ # Generate the erb pages with textile formatting - e.g. index/authors result = view.render(:layout => 'layout', :file => guide) f.write textile(result) @@ -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 |