diff options
author | Xavier Noria <fxn@hashref.com> | 2010-02-17 20:22:37 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-02-17 20:22:37 +0100 |
commit | f3eab8e6639db77ba414ea3b0bf17c94cadecba9 (patch) | |
tree | 69471b69e62551d1386148a6341132032e0b8fe4 /railties/guides | |
parent | b6935e5179fce959a1bf4ea62114e8d86584ac68 (diff) | |
download | rails-f3eab8e6639db77ba414ea3b0bf17c94cadecba9.tar.gz rails-f3eab8e6639db77ba414ea3b0bf17c94cadecba9.tar.bz2 rails-f3eab8e6639db77ba414ea3b0bf17c94cadecba9.zip |
adds support for an edge badge in guides
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/images/edge_badge.png | bin | 0 -> 9095 bytes | |||
-rw-r--r-- | railties/guides/rails_guides/generator.rb | 11 |
2 files changed, 9 insertions, 2 deletions
diff --git a/railties/guides/images/edge_badge.png b/railties/guides/images/edge_badge.png Binary files differnew file mode 100644 index 0000000000..274801bb71 --- /dev/null +++ b/railties/guides/images/edge_badge.png diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb index b931dd6c28..2f0718af75 100644 --- a/railties/guides/rails_guides/generator.rb +++ b/railties/guides/rails_guides/generator.rb @@ -49,16 +49,19 @@ module RailsGuides 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) + result = textile(result) else body = File.read(File.join(view_path, guide)) body = set_header_section(body, @view) body = set_index(body, @view) 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 + + result = insert_edge_badge(result) if ENV.key?('INSERT_EDGE_BADGE') + f.write result end end @@ -168,5 +171,9 @@ module RailsGuides end end end + + def insert_edge_badge(html) + html.sub(/<body[^>]*>/, '\&<img src="images/edge_badge.png" style="position:fixed; right:0px; top:0px; border:none; z-index:100"/>') + end end end |