(temporary hack) generate a main file for RDoc escaping "Rails"

RDoc autolinks the word "Rails" to the doc page for the Rails module.
But README.rdoc is displayed in the home page at GitHub and the slashes
are visible there, which is weird. We leave by now the slashes off in
the file, and generate a second file for the API with them.
This commit is contained in:
Xavier Noria 2011-05-01 13:15:15 +02:00
parent 2fbf302149
commit e68b7a001d
3 changed files with 22 additions and 11 deletions

1
.gitignore vendored
View File

@ -22,3 +22,4 @@ railties/doc
railties/guides/output railties/guides/output
railties/tmp railties/tmp
.rvmrc .rvmrc
RDOC_MAIN.rdoc

View File

@ -1,6 +1,6 @@
== Welcome to \Rails == Welcome to Rails
\Rails is a web-application framework that includes everything needed to create Rails is a web-application framework that includes everything needed to create
database-backed web applications according to the Model-View-Control pattern. database-backed web applications according to the Model-View-Control pattern.
This pattern splits the view (also called the presentation) into "dumb" This pattern splits the view (also called the presentation) into "dumb"
@ -11,7 +11,7 @@ persist themselves to a database. The controller handles the incoming requests
(such as Save New Account, Update Product, Show Post) by manipulating the model (such as Save New Account, Update Product, Show Post) by manipulating the model
and directing data to the view. and directing data to the view.
In \Rails, the model is handled by what's called an object-relational mapping In Rails, the model is handled by what's called an object-relational mapping
layer entitled Active Record. This layer allows you to present the data from layer entitled Active Record. This layer allows you to present the data from
database rows as objects and embellish these data objects with business logic database rows as objects and embellish these data objects with business logic
methods. You can read more about Active Record in its methods. You can read more about Active Record in its
@ -22,17 +22,17 @@ layers by its two parts: Action View and Action Controller. These two layers
are bundled in a single package due to their heavy interdependence. This is are bundled in a single package due to their heavy interdependence. This is
unlike the relationship between the Active Record and Action Pack that is much unlike the relationship between the Active Record and Action Pack that is much
more separate. Each of these packages can be used independently outside of more separate. Each of these packages can be used independently outside of
\Rails. You can read more about Action Pack in its Rails. You can read more about Action Pack in its
{README}[link:files/actionpack/README_rdoc.html]. {README}[link:files/actionpack/README_rdoc.html].
== Getting Started == Getting Started
1. Install \Rails at the command prompt if you haven't yet: 1. Install Rails at the command prompt if you haven't yet:
gem install rails gem install rails
2. At the command prompt, create a new \Rails application: 2. At the command prompt, create a new Rails application:
rails new myapp rails new myapp
@ -59,10 +59,10 @@ more separate. Each of these packages can be used independently outside of
== Contributing == Contributing
We encourage you to contribute to Ruby on \Rails! Please check out the {Contributing to Rails We encourage you to contribute to Ruby on Rails! Please check out the {Contributing to Rails
guide}[http://edgeguides.rubyonrails.org/contributing_to_rails.html] for guidelines about how guide}[http://edgeguides.rubyonrails.org/contributing_to_rails.html] for guidelines about how
to proceed. {Join us}[http://contributors.rubyonrails.org]! to proceed. {Join us}[http://contributors.rubyonrails.org]!
== License == License
Ruby on \Rails is released under the MIT license. Ruby on Rails is released under the MIT license.

View File

@ -49,14 +49,24 @@ end
desc "Generate documentation for the Rails framework" desc "Generate documentation for the Rails framework"
RDoc::Task.new do |rdoc| RDoc::Task.new do |rdoc|
RDOC_MAIN = 'RDOC_MAIN.rdoc'
rdoc.before_running_rdoc do
rdoc_main = File.read('README.rdoc')
rdoc_main.gsub!(/\b(?=Rails)\b/) { '\\' }
File.open(RDOC_MAIN, 'w') do |f|
f.write(rdoc_main)
end
rdoc.rdoc_files.include(RDOC_MAIN)
end
rdoc.rdoc_dir = 'doc/rdoc' rdoc.rdoc_dir = 'doc/rdoc'
rdoc.title = "Ruby on Rails Documentation" rdoc.title = "Ruby on Rails Documentation"
rdoc.options << '-f' << 'horo' rdoc.options << '-f' << 'horo'
rdoc.options << '-c' << 'utf-8' rdoc.options << '-c' << 'utf-8'
rdoc.options << '-m' << 'README.rdoc' rdoc.options << '-m' << RDOC_MAIN
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('railties/CHANGELOG') rdoc.rdoc_files.include('railties/CHANGELOG')
rdoc.rdoc_files.include('railties/MIT-LICENSE') rdoc.rdoc_files.include('railties/MIT-LICENSE')