Skip to content
Browse files

guides: rewrites index and credit pages as pure HTML to avoid textili…

…zing the rendered view, in particular we can now put a DOCTYPE in the layout
  • Loading branch information...
1 parent 824fa10 commit b786940248f3cbb0db62a95a6b2f1c205788c83f @fxn fxn committed Mar 31, 2010
View
25 railties/guides/rails_guides/generator.rb
@@ -11,7 +11,9 @@
module RailsGuides
class Generator
- attr_reader :guides_dir, :source_dir, :output_dir
+ attr_reader :guides_dir, :source_dir, :output_dir
+
+ GUIDES_RE = /\.(?:textile|html\.erb)$/
def initialize(output=nil)
initialize_dirs(output)
@@ -42,7 +44,7 @@ def generate_guides
end
def guides_to_generate
- guides = Dir.entries(source_dir).grep(/\.textile(?:\.erb)?$/)
+ guides = Dir.entries(source_dir).grep(GUIDES_RE)
ENV.key?("ONLY") ? select_only(guides) : guides
end
@@ -59,7 +61,7 @@ def copy_assets
end
def output_file_for(guide)
- guide.sub(/\.textile(?:\.erb)?$/, '.html')
+ guide.sub(GUIDES_RE, '.html')
end
def generate?(source_file, output_file)
@@ -74,10 +76,9 @@ def generate_guide(guide, output_file)
view = ActionView::Base.new(source_dir)
view.extend(Helpers)
- if guide =~ /\.textile\.erb$/
+ if guide =~ /\.html\.erb$/
# Generate the erb pages with textile formatting - e.g. index/authors
result = view.render(:layout => 'layout', :file => guide)
- result = textile(result)
else
body = File.read(File.join(source_dir, guide))
body = set_header_section(body, view)
@@ -87,12 +88,9 @@ def generate_guide(guide, output_file)
warn_about_broken_links(result) if ENV.key?("WARN_BROKEN_LINKS")
end
-
- # FIXME: If the doctype is in the layout textile escapes it.
- # Things should be set up in a way that prevents that, a doctype
- # belongs to the layout.
- result = insert_doctype(result)
+
result = insert_edge_badge(result) if ENV.key?('INSERT_EDGE_BADGE')
+
f.write result
end
end
@@ -203,13 +201,6 @@ def check_fragment_identifiers(html, anchors)
end
end
end
-
- def insert_doctype(html)
- <<EOS + html
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-EOS
- 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"/>')
View
60 railties/guides/source/credits.html.erb
@@ -0,0 +1,60 @@
+<% content_for :header_section do %>
+<h2>Credits</h2>
+
+<p>We'd like to thank the following people for their tireless contributions to this project.</p>
+
+<% end %>
+
+<h3 class="section">Rails Documentation Team</h3>
+
+<%= author('Mike Gunderloy', 'mgunderloy') do %>
+ <p>Mike Gunderloy is a consultant with <a href="http://www.actionrails.com">ActionRails</a>. He brings 25 years of experience in a variety of languages to bear on his current work with Rails. His near-daily links and other blogging can be found at <a href="http://afreshcup.com">A Fresh Cup</a> and he <a href="http://twitter.com/MikeG1">twitters</a> too much.</p>
+<% end %>
+
+<%= author('Pratik Naik', 'lifo') do %>
+ <p>Pratik Naik is a Ruby on Rails consultant with <a href="http://www.actionrails.com">ActionRails</a> and also a member of the <a href="http://rubyonrails.org/core">Rails core team</a>. He maintains a blog at <a href="http://m.onkey.org">has_many :bugs, :through =&gt; :rails</a> and has an active <a href="http://twitter.com/lifo">twitter account</a>.</p>
+<% end %>
+
+<%= author('Xavier Noria', 'fxn', 'fxn.png') do %>
+ <p>Xavier has been into Rails since 2005, he is currently a Rails consultant. Xavier is Rails committer and enjoys combining his passion for Rails and his past life as a proofreader of math textbooks. Oh, he also <a href="http://twitter.com/fxn">tweets</a> and can be found everywhere as &quot;fxn&quot;.</p>
+<% end %>
+
+<h3 class="section">Rails Guides Designers</h3>
+
+<%= author('Jason Zimdars', 'jz') do %>
+ <p>Jason Zimdars is an experienced creative director and web designer who has lead UI and UX design for numerous websites and web applications. You can see more of his design and writing at <a href="http://www.thinkcage.com/">Thinkcage.com</a> or follow him on <a href="http://twitter.com/JZ">Twitter</a>.</p>
+<% end %>
+
+<h3 class="section">Rails Guides Authors</h3>
+
+<%= author('Frederick Cheung', 'fcheung') do %>
+ <p>Frederick Cheung is Chief Wizard at Texperts where he has been using Rails since 2006. He is based in Cambridge (UK) and when not consuming fine ales he blogs at <a href="http://www.spacevatican.org">spacevatican.org</a>.</p>
+<% end %>
+
+<%= author('Tore Darell', 'toretore') do %>
+ <p>Tore Darell is an independent developer based in Menton, France who specialises in cruft-free web applications using Ruby, Rails and unobtrusive JavaScript. His home on the internet is his blog <a href="http://tore.darell.no">Sneaky Abstractions</a>.</p>
+<% end %>
+
+<%= author('Jeff Dean', 'zilkey') do %>
+ <p>Jeff Dean is a software engineer with <a href="http://pivotallabs.com">Pivotal Labs</a>.</p>
+<% end %>
+
+<%= author('Cássio Marques', 'cmarques') do %>
+ <p>Cássio Marques is a Brazilian software developer working with different programming languages such as Ruby, JavaScript, CPP and Java, as an independent consultant. He blogs at <a href="http://cassiomarques.wordpress.com">/* CODIFICANDO */</a>, which is mainly written in Portuguese, but will soon get a new section for posts with English translation.
+<% end %>
+
+<%= author('James Miller', 'bensie') do %>
+ <p>James Miller is a software developer for <a href="http://www.jk-tech.com">JK Tech</a> in San Diego, CA. Find me on GitHub, Gmail, Twitter, and Freenode as &quot;bensie&quot;.</p>
+<% end %>
+
+<%= author('Emilio Tagua', 'miloops') do %>
+ <p>Emilio Tagua &mdash;a.k.a. miloops&mdash; is an Argentinian entrepreneur, developer, open source contributor and Rails evangelist. Cofounder of <a href="http://eventioz.com">Eventioz</a>. He has been using Rails since 2006 and contributing since early 2008. Can be found at gmail, twitter, freenode, everywhere as &quot;miloops&quot;.</p>
+<% end %>
+
+<%= author('Heiko Webers', 'hawe') do %>
+ <p>Heiko Webers is the founder of <a href="http://www.bauland42.de">bauland42</a>, a German web application security consulting and development company focused on Ruby on Rails. He blogs at the <a href="http://www.rorsecurity.info">Ruby on Rails Security Project</a>. After 10 years of desktop application development, Heiko has rarely looked back.</p>
+<% end %>
+
+<%= author('Mikel Lindsaar', 'raasdnil') do %>
+ <p>Mikel Lindsaar has been working with Rails since 2006 and is the author of the Ruby Mail gem and core contributor (he helped re-write Action Mailer's API). Mikel has a <a href="http://lindsaar.net/">blog</a> and <a href="http://twitter.com/raasdnil">tweets</a>.
+<% end %>
View
60 railties/guides/source/credits.textile.erb
@@ -1,60 +0,0 @@
-<% content_for :header_section do %>
-h2. Credits
-
-p. We'd like to thank the following people for their tireless contributions to this project.
-
-<% end %>
-
-<h3 class="section">Rails Documentation Team</h3>
-
-<%= author('Mike Gunderloy', 'mgunderloy') do %>
- Mike Gunderloy is a consultant with "ActionRails":http://www.actionrails.com. He brings 25 years of experience in a variety of languages to bear on his current work with Rails. His near-daily links and other blogging can be found at "A Fresh Cup":http://afreshcup.com and he "twitters":http://twitter.com/MikeG1 too much.
-<% end %>
-
-<%= author('Pratik Naik', 'lifo') do %>
- Pratik Naik is a Ruby on Rails consultant with "ActionRails":http://www.actionrails.com and also a member of the "Rails core team":http://rubyonrails.org/core. He maintains a blog at "has_many :bugs, :through => :rails":http://m.onkey.org and has an active "twitter account":http://twitter.com/lifo.
-<% end %>
-
-<%= author('Xavier Noria', 'fxn', 'fxn.png') do %>
- Xavier has been into Rails since 2005, he is currently a Rails consultant. Xavier is president of the <a href="http://www.srug.org/">Spanish Ruby Users Group</a> and has been involved in Rails in several ways. He enjoys combining his passion for Rails and his past life as a proofreader of math textbooks. Oh, he also "tweets":http://twitter.com/fxn!
-<% end %>
-
-<h3 class="section">Rails Guides Designers</h3>
-
-<%= author('Jason Zimdars', 'jz') do %>
- Jason Zimdars is an experienced creative director and web designer who has lead UI and UX design for numerous websites and web applications. You can see more of his design and writing at <a href="http://www.thinkcage.com/">Thinkcage.com</a> or follow him on <a href="http://twitter.com/JZ">Twitter</a>.
-<% end %>
-
-<h3 class="section">Rails Guides Authors</h3>
-
-<%= author('Frederick Cheung', 'fcheung') do %>
- Frederick Cheung is Chief Wizard at Texperts where he has been using Rails since 2006. He is based in Cambridge (UK) and when not consuming fine ales he blogs at "spacevatican.org":http://www.spacevatican.org.
-<% end %>
-
-<%= author('Tore Darell', 'toretore') do %>
- Tore Darell is an independent developer based in Menton, France who specialises in cruft-free web applications using Ruby, Rails and unobtrusive JavaScript. His home on the internet is his blog "Sneaky Abstractions":http://tore.darell.no.
-<% end %>
-
-<%= author('Jeff Dean', 'zilkey') do %>
- Jeff Dean is a software engineer with "Pivotal Labs":http://pivotallabs.com.
-<% end %>
-
-<%= author('Cássio Marques', 'cmarques') do %>
- Cássio Marques is a Brazilian software developer working with different programming languages such as Ruby, JavaScript, CPP and Java, as an independent consultant. He blogs at "/* CODIFICANDO */":http://cassiomarques.wordpress.com, which is mainly written in Portuguese, but will soon get a new section for posts with English translation.
-<% end %>
-
-<%= author('James Miller', 'bensie') do %>
- James Miller is a software developer for "JK Tech":http://www.jk-tech.com in San Diego, CA. Find me on GitHub, Gmail, Twitter, and Freenode as bensie.
-<% end %>
-
-<%= author('Emilio Tagua', 'miloops') do %>
- Emilio Tagua -- a.k.a. miloops -- is an Argentinian entrepreneur, developer, open source contributor and Rails evangelist. Cofounder of "Eventioz":http://eventioz.com. He has been using Rails since 2006 and contributing since early 2008. Can be found at gmail, twitter, freenode, everywhere as miloops.
-<% end %>
-
-<%= author('Heiko Webers', 'hawe') do %>
- Heiko Webers is the founder of "bauland42":http://www.bauland42.de, a German web application security consulting and development company focused on Ruby on Rails. He blogs at the "Ruby on Rails Security Project":http://www.rorsecurity.info. After 10 years of desktop application development, Heiko has rarely looked back.
-<% end %>
-
-<%= author('Mikel Lindsaar', 'raasdnil') do %>
- Mikel Lindsaar has been working with Rails since 2006 and is the author of the Ruby Mail gem and core contributor (he helped re-write ActionMailer's API). Mikel has a "blog":http://lindsaar.net/ and "tweets":http://twitter.com/raasdnil.
-<% end %>
View
140 railties/guides/source/index.html.erb
@@ -0,0 +1,140 @@
+<% content_for :header_section do %>
+<h2>Ruby on Rails Guides</h2>
+
+<p>These guides are designed to make you immediately productive with Rails, and to help you understand how all of the pieces fit together. There are two different versions of the Guides site, and you should be sure to use the one that applies to your situation:</p>
+
+<ul>
+<li><a href="http://guides.rubyonrails.org">Current release version</a> - based on Rails 2.3.
+<li><a href="http://edgeguides.rubyonrails.org">Edge version</a> - based on the current Rails <a href="http://github.com/rails/rails/tree/master">master branch</a>.
+
+<% end %>
+
+<% content_for :index_section do %>
+<div id="subCol">
+ <dl>
+ <dd class="warning">Rails Guides are a result of the ongoing <a href="http://hackfest.rubyonrails.org">Guides hackfest</a>, and a work in progress.</dd>
+ <dd class="ticket">Guides marked with this icon are currently being worked on. While they might still be useful to you, they may contain incomplete information and even errors. You can help by reviewing them and posting your comments and corrections at the respective Lighthouse ticket.</dd>
+ </dl>
+</div>
+<% end %>
+
+<h3>Start Here</h3>
+
+<dl>
+<%= guide('Getting Started with Rails', 'getting_started.html') do %>
+ <p>Everything you need to know to install Rails and create your first application.</p>
+<% end %>
+</dl>
+
+<h3>Models</h3>
+
+<dl>
+<%= guide("Rails Database Migrations", 'migrations.html') do %>
+ <p>This guide covers how you can use Active Record migrations to alter your database in a structured and organized manner.</p>
+<% end %>
+
+<%= guide("Active Record Validations and Callbacks", 'activerecord_validations_callbacks.html') do %>
+ <p>This guide covers how you can use Active Record validations and callbacks.</p>
+<% end %>
+
+<%= guide("Active Record Associations", 'association_basics.html') do %>
+ <p>This guide covers all the associations provided by Active Record.</p>
+<% end %>
+
+<%= guide("Active Record Query Interface", 'active_record_querying.html') do %>
+ <p>This guide covers the database query interface provided by Active Record.</p>
+<% end %>
+</dl>
+
+<h3>Views</h3>
+
+<dl>
+<%= guide("Layouts and Rendering in Rails", 'layouts_and_rendering.html') do %>
+ <p>This guide covers the basic layout features of Action Controller and Action View, including rendering and redirecting, using content_for blocks, and working with partials.</p>
+<% end %>
+
+<%= guide("Action View Form Helpers", 'form_helpers.html', :ticket => 1) do %>
+ <p>Guide to using built in Form helpers.</p>
+<% end %>
+</dl>
+
+<h3>Controllers</h3>
+
+<dl>
+<%= guide("Action Controller Overview", 'action_controller_overview.html') do %>
+ <p>This guide covers how controllers work and how they fit into the request cycle in your application. It includes sessions, filters, and cookies, data streaming, and dealing with exceptions raised by a request, among other topics.</p>
+<% end %>
+
+<%= guide("Rails Routing from the Outside In", 'routing.html') do %>
+ <p>This guide covers the user-facing features of Rails routing. If you want to understand how to use routing in your own Rails applications, start here.</p>
+<% end %>
+</dl>
+
+<h3>Digging Deeper</h3>
+
+<dl>
+
+<%= guide("Rails on Rack", 'rails_on_rack.html') do %>
+ <p>This guide covers Rails integration with Rack and interfacing with other Rack components.</p>
+<% end %>
+
+<%= guide("Rails Internationalization API", 'i18n.html') do %>
+ <p>This guide covers how to add internationalization to your applications. Your application will be able to translate content to different languages, change pluralization rules, use correct date formats for each country and so on.</p>
+<% end %>
+
+<%= guide("Action Mailer Basics", 'action_mailer_basics.html', :ticket => 25) do %>
+ <p>This guide describes how to use Action Mailer to send and receive emails.</p>
+<% end %>
+
+<%= guide("Testing Rails Applications", 'testing.html', :ticket => 8) do %>
+ <p>This is a rather comprehensive guide to doing both unit and functional tests in Rails. It covers everything from &quot;What is a test?&quot; to the testing APIs. Enjoy.</p>
+<% end %>
+
+<%= guide("Securing Rails Applications", 'security.html') do %>
+ <p>This guide describes common security problems in web applications and how to avoid them with Rails.</p>
+<% end %>
+
+<%= guide("Debugging Rails Applications", 'debugging_rails_applications.html') do %>
+ <p>This guide describes how to debug Rails applications. It covers the different ways of achieving this and how to understand what is happening "behind the scenes" of your code.</p>
+<% end %>
+
+<%= guide("Performance Testing Rails Applications", 'performance_testing.html') do %>
+ <p>This guide covers the various ways of performance testing a Ruby on Rails application.</p>
+<% end %>
+
+<%= guide("The Basics of Creating Rails Plugins", 'plugins.html', :ticket => 32) do %>
+ <p>This guide covers how to build a plugin to extend the functionality of Rails.</p>
+<% end %>
+
+<%= guide("Configuring Rails Applications", 'configuring.html') do %>
+ <p>This guide covers the basic configuration settings for a Rails application.</p>
+<% end %>
+
+<%= guide("Rails Command Line Tools and Rake tasks", 'command_line.html', :ticket => 29) do %>
+ <p>This guide covers the command line tools and rake tasks provided by Rails.</p>
+<% end %>
+
+<%= guide("Caching with Rails", 'caching_with_rails.html', :ticket => 10) do %>
+ <p>Various caching techniques provided by Rails.</p>
+<% end %>
+
+<%= guide("Contributing to Rails", 'contributing_to_rails.html') do %>
+ <p>Rails is not &quot;somebody else's framework.&quot; This guide covers a variety of ways that you can get involved in the ongoing development of Rails.</p>
+<% end %>
+</dl>
+
+<h3>Release Notes</h3>
+
+<dl>
+<%= guide("Ruby on Rails 3.0 Release Notes", '3_0_release_notes.html') do %>
+ <p>Release notes for Rails 3.0.</p>
+<% end %>
+
+<%= guide("Ruby on Rails 2.3 Release Notes", '2_3_release_notes.html') do %>
+ <p>Release notes for Rails 2.3.</p>
+<% end %>
+
+<%= guide("Ruby on Rails 2.2 Release Notes", '2_2_release_notes.html') do %>
+ <p>Release notes for Rails 2.2.</p>
+<% end %>
+</dl>
View
139 railties/guides/source/index.textile.erb
@@ -1,139 +0,0 @@
-<% content_for :header_section do %>
-h2. Ruby on Rails Guides
-
-These guides are designed to make you immediately productive with Rails, and to help you understand how all of the pieces fit together. There are two different versions of the Guides site, and you should be sure to use the one that applies to your situation:
-
-* "Current Release version":http://guides.rubyonrails.org - based on Rails 2.3
-* "Edge version":http://edgeguides.rubyonrails.org - based on the current Rails "master branch":http://github.com/rails/rails/tree/master
-
-<% end %>
-
-<% content_for :index_section do %>
-<div id="subCol">
- <dl>
- <dd class="warning">Rails Guides are a result of the ongoing "Guides hackfest":http://hackfest.rubyonrails.org and a work in progress.</dd>
- <dd class="ticket">Guides marked with this icon are currently being worked on. While they might still be useful to you, they may contain incomplete information and even errors. You can help by reviewing them and posting your comments and corrections at the respective Lighthouse ticket.</dd>
- </dl>
-</div>
-<% end %>
-
-h3. Start Here
-
-<dl>
-<%= guide('Getting Started with Rails', 'getting_started.html') do %>
- Everything you need to know to install Rails and create your first application.
-<% end %>
-</dl>
-
-h3. Models
-
-<dl>
-<%= guide("Rails Database Migrations", 'migrations.html') do %>
- This guide covers how you can use Active Record migrations to alter your database in a structured and organized manner.
-<% end %>
-
-<%= guide("Active Record Validations and Callbacks", 'activerecord_validations_callbacks.html') do %>
- This guide covers how you can use Active Record validations and callbacks.
-<% end %>
-
-<%= guide("Active Record Associations", 'association_basics.html') do %>
- This guide covers all the associations provided by Active Record.
-<% end %>
-
-<%= guide("Active Record Query Interface", 'active_record_querying.html') do %>
- This guide covers the database query interface provided by Active Record.
-<% end %>
-</dl>
-
-h3. Views
-
-<dl>
-<%= guide("Layouts and Rendering in Rails", 'layouts_and_rendering.html') do %>
- This guide covers the basic layout features of Action Controller and Action View, including rendering and redirecting, using content_for blocks, and working with partials.
-<% end %>
-
-<%= guide("Action View Form Helpers", 'form_helpers.html', :ticket => 1) do %>
- Guide to using built in Form helpers.
-<% end %>
-</dl>
-
-h3. Controllers
-
-<dl>
-<%= guide("Action Controller Overview", 'action_controller_overview.html') do %>
- This guide covers how controllers work and how they fit into the request cycle in your application. It includes sessions, filters, and cookies, data streaming, and dealing with exceptions raised by a request, among other topics.
-<% end %>
-
-<%= guide("Rails Routing from the Outside In", 'routing.html') do %>
- This guide covers the user-facing features of Rails routing. If you want to understand how to use routing in your own Rails applications, start here.
-<% end %>
-</dl>
-
-h3. Digging Deeper
-
-<dl>
-
-<%= guide("Rails on Rack", 'rails_on_rack.html') do %>
- This guide covers Rails integration with Rack and interfacing with other Rack components.
-<% end %>
-
-<%= guide("Rails Internationalization API", 'i18n.html') do %>
- This guide covers how to add internationalization to your applications. Your application will be able to translate content to different languages, change pluralization rules, use correct date formats for each country and so on.
-<% end %>
-
-<%= guide("Action Mailer Basics", 'action_mailer_basics.html', :ticket => 25) do %>
- This guide describes how to use Action Mailer to send and receive emails.
-<% end %>
-
-<%= guide("Testing Rails Applications", 'testing.html', :ticket => 8) do %>
- This is a rather comprehensive guide to doing both unit and functional tests in Rails. It covers everything from “What is a test?” to the testing APIs. Enjoy.
-<% end %>
-
-<%= guide("Securing Rails Applications", 'security.html') do %>
- This guide describes common security problems in web applications and how to avoid them with Rails.
-<% end %>
-
-<%= guide("Debugging Rails Applications", 'debugging_rails_applications.html') do %>
- This guide describes how to debug Rails applications. It covers the different ways of achieving this and how to understand what is happening "behind the scenes" of your code.
-<% end %>
-
-<%= guide("Performance Testing Rails Applications", 'performance_testing.html') do %>
- This guide covers the various ways of performance testing a Ruby on Rails application.
-<% end %>
-
-<%= guide("The Basics of Creating Rails Plugins", 'plugins.html', :ticket => 32) do %>
- This guide covers how to build a plugin to extend the functionality of Rails.
-<% end %>
-
-<%= guide("Configuring Rails Applications", 'configuring.html') do %>
- This guide covers the basic configuration settings for a Rails application.
-<% end %>
-
-<%= guide("Rails Command Line Tools and Rake tasks", 'command_line.html', :ticket => 29) do %>
- This guide covers the command line tools and rake tasks provided by Rails.
-<% end %>
-
-<%= guide("Caching with Rails", 'caching_with_rails.html', :ticket => 10) do %>
- Various caching techniques provided by Rails.
-<% end %>
-
-<%= guide("Contributing to Rails", 'contributing_to_rails.html') do %>
- Rails is not "somebody else's framework." This guide covers a variety of ways that you can get involved in the ongoing development of Rails.
-<% end %>
-</dl>
-
-h3. Release Notes
-
-<dl>
-<%= guide("Ruby on Rails 3.0 Release Notes", '3_0_release_notes.html') do %>
- Release notes for Rails 3.0.
-<% end %>
-
-<%= guide("Ruby on Rails 2.3 Release Notes", '2_3_release_notes.html') do %>
- Release notes for Rails 2.3.
-<% end %>
-
-<%= guide("Ruby on Rails 2.2 Release Notes", '2_2_release_notes.html') do %>
- Release notes for Rails 2.2.
-<% end %>
-</dl>
View
3 railties/guides/source/layout.html.erb
@@ -1,3 +1,6 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

0 comments on commit b786940

Please sign in to comment.
Something went wrong with that request. Please try again.