Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed the tocs and specs

  • Loading branch information...
commit 7fe2a798736f1005ef161512e20669b2ee9341c9 1 parent 4af777a
@mattetti mattetti authored
View
2  Rakefile
@@ -51,7 +51,7 @@ task :create_chapter_tocs do
end
end
else
- chapters = Dir["#{Dir.pwd}/book-content/#{ENV["LANG"]}/*-*"].entries.map{|f| File.basename(f)[/\d-(.*)/, 1]}
+ chapters = Dir["#{Dir.pwd}/book-content/#{ENV["LANG"]}/*-*"].entries.map{|f| File.basename(f)[/\d+-(.*)/, 1]}
chapters.each do |chapter|
save_chapter_toc(chapter, ENV["LANG"])
end
View
1  app/controllers/pages.rb
@@ -14,6 +14,7 @@ def show
def table_of_content
toc_file = Dir["#{Merb.root}/book-content/#{language}/toc.*"].entries.first
+ raise NotFound unless toc_file
text = File.open(toc_file).read
render ::Maruku::new(text).to_html
end
View
2  app/helpers/global_helpers.rb
@@ -22,7 +22,7 @@ def rtl_support_class
# Returns links to the previous and next pages.
def page_nav_links(format = 'markdown')
- return if params[:action] != 'show' # Don't need navigation for the TOC (index).
+ return if params[:action] != 'show' || @page.nil? # Don't need navigation for the TOC (index).
links = []
links << previous_page_url
# Stick a link to the TOC in the middle of the array.
View
5 book-content/en/0-front-matter/2-contributors.markdown
@@ -13,8 +13,9 @@ Thank you all!
* [Yehuda Katz ](http://yehudakatz.com)
* [Makoto Kuwata ](http://www.kuwata-lab.com/)
* [Rich Morin ](http://cfcl.com/rdm)
-* [Carlo Pecchia ](http://carlopecchia.eu)
+* [Carlo Pecchia ](http://carlopecchia.eu)
* [Markus Prinz ](http://blog.nuclearsquid.com/)
* [Foy Savas ](http://foysavas.com/)
* [Kurt Schrader ](http://kurt.karmalab.org/)
-* [Arthur Zapparoli ](http://arthurgeek.net/)
+* [Arthur Zapparoli ](http://arthurgeek.net/)
+* [Jai-Gouk Kim ](http://jaigouk.blogspot.com/)
View
2  book-content/en/4-interacting-with-the-database-active_record/toc.markdown
@@ -2,4 +2,4 @@
<ul class='toc'><li><a href='/en/interacting-with-the-database-active_record/up'>Setting Up Active Record</a></li></ul>
-<ul class='toc'><li><a href='/en/interacting-with-the-database-active_record/queries'>Database Queries</a></li></ul>
+<ul class='toc'><li><a href='/en/interacting-with-the-database-active_record/queries'>Database Queries</a></li></ul>
View
15 book-content/en/5-interacting-with-the-database-sequel/toc.markdown
@@ -1,10 +1,13 @@
# interacting-with-the-database-sequel
-1. [Installation and setup](/interacting-with-the-database-sequel/setting-up)
-1. [Database Migrations](/interacting-with-the-database-sequel/migrations)
-1. [Data Retrieval and Manipulation](/interacting-with-the-database-sequel/data-retrieval-and-manipulation)
-1. [Model Associations](/interacting-with-the-database-sequel/model-associations)
-1. [Model Validation](/interacting-with-the-database-sequel/model-validation)
-1. [Sequel Plugins](/interacting-with-the-database-sequel/sequel-plugins)
+ <ul class='toc'><li><a href='/en/interacting-with-the-database-sequel/up'>Installation and setup</a><ul style='list-style: none;'><li><a href='/en/interacting-with-the-database-sequel/up#generating_a_project_with_sequel'>Generating a project with Sequel</a></li></ul></li></ul>
+<ul class='toc'><li><a href='/en/interacting-with-the-database-sequel/migrations'>Database Migrations</a></li></ul>
+<ul class='toc'><li><a href='/en/interacting-with-the-database-sequel/manipulation'>Database Retreival and Manipulation</a><ul style='list-style: none;'><li><a href='/en/interacting-with-the-database-sequel/manipulation#finding_records'>Finding records</a></li><li><a href='/en/interacting-with-the-database-sequel/manipulation#the_other_three_letters_in_crud'>The Other Three Letters in CRUD</a><ul style='list-style: none;'><li><a href='/en/interacting-with-the-database-sequel/manipulation#create'>Create</a></li><li><a href='/en/interacting-with-the-database-sequel/manipulation#update'>Update</a></li><li><a href='/en/interacting-with-the-database-sequel/manipulation#delete'>Delete</a></li></ul></li></ul></li></ul>
+
+<ul class='toc'><li><a href='/en/interacting-with-the-database-sequel/associations'>Model Associations</a><ul style='list-style: none;'><li><a href='/en/interacting-with-the-database-sequel/associations#one_to_many'>One to Many</a></li><li><a href='/en/interacting-with-the-database-sequel/associations#many_to_one'>Many to One</a></li><li><a href='/en/interacting-with-the-database-sequel/associations#many_to_many'>Many to Many</a></li><li><a href='/en/interacting-with-the-database-sequel/associations#one_to_one'>One to One</a></li></ul></li></ul>
+
+<ul class='toc'><li><a href='/en/interacting-with-the-database-sequel/validation'>Model Validation</a></li></ul>
+
+<ul class='toc'><li><a href='/en/interacting-with-the-database-sequel/plugins'>Sequel Plugins</a><ul style='list-style: none;'><li><a href='/en/interacting-with-the-database-sequel/plugins#useful_plugins'>Useful Plugins</a><ul style='list-style: none;'><li><a href='/en/interacting-with-the-database-sequel/plugins#sequel_timestamped'>sequel_timestamped</a></li><li><a href='/en/interacting-with-the-database-sequel/plugins#sequel_notnaughty'>sequel_notnaughty</a></li><li><a href='/en/interacting-with-the-database-sequel/plugins#sequel_polymorphic'>sequel_polymorphic</a></li><li><a href='/en/interacting-with-the-database-sequel/plugins#sequel_taggable'>sequel_taggable</a></li></ul></li></ul></li></ul>
View
9 book-content/en/5-testing-your-application/toc.markdown
@@ -1,9 +0,0 @@
-# testing-your-application
-
- <ul class='toc'><li><a href='/en/testing-your-application/why'>Why test</a><ul style='list-style: none;'><li><a href='/en/testing-your-application/why#types_of_tests'>Types of Tests</a><ul style='list-style: none;'><li><a href='/en/testing-your-application/why#models'>Models</a></li><li><a href='/en/testing-your-application/why#requests'>Requests</a></li><li><a href='/en/testing-your-application/why#integration'>Integration</a></li></ul></li></ul></li></ul>
-
-<ul class='toc'><li><a href='/en/testing-your-application/models'>Testing your models</a></li></ul>
-
-<ul class='toc'><li><a href='/en/testing-your-application/requests'>Testing your requests</a></li></ul>
-
-<ul class='toc'><li><a href='/en/testing-your-application/cucumber'>Integration testing with Cucumber</a><ul style='list-style: none;'><li><a href='/en/testing-your-application/cucumber#merb_and_cucumber'>Merb and Cucumber</a></li><li><a href='/en/testing-your-application/cucumber#creating_new_features'>Creating new features</a></li></ul></li></ul>
View
11 book-content/en/6-merb-more/toc.markdown
@@ -1,11 +0,0 @@
-# merb-more
-
- <ul class='toc'><li><a href='/en/merb-more/authentication'>Authentication</a><ul style='list-style: none;'><li><a href='/en/merb-more/authentication#merbauth_gems'>Merb-auth gems</a><ul style='list-style: none;'><li><a href='/en/merb-more/authentication#merbauthcore'>merb-auth-core</a></li><li><a href='/en/merb-more/authentication#merbauthmore'>merb-auth-more</a></li><li><a href='/en/merb-more/authentication#merbauthslicepassword'>merb-auth-slice-password</a></li></ul></li><li><a href='/en/merb-more/authentication#authentication_in_merb_stack'>Authentication in Merb Stack</a></li><li><a href='/en/merb-more/authentication#authenticated_hello_world'>Authenticated Hello World</a><ul style='list-style: none;'><li><a href='/en/merb-more/authentication#generate_an_application'>Generate an application</a></li><li><a href='/en/merb-more/authentication#generate_something_to_protect'>Generate something to protect</a></li><li><a href='/en/merb-more/authentication#protect_the_route'>Protect the route</a></li><li><a href='/en/merb-more/authentication#protect_the_controller'>Protect the controller</a></li><li><a href='/en/merb-more/authentication#overwrite_the_default_views'>Overwrite the default views</a></li></ul></li><li><a href='/en/merb-more/authentication#testing_an_authenticated_request'>Testing an authenticated request</a></li></ul></li></ul>
-
-<ul class='toc'><li><a href='/en/merb-more/mailer'>Mailer</a></li></ul>
-
-<ul class='toc'><li><a href='/en/merb-more/caching'>Caching</a></li></ul>
-
-<ul class='toc'><li><a href='/en/merb-more/exceptions'>Exceptions</a></li></ul>
-
-<ul class='toc'><li><a href='/en/merb-more/slices'>Slices</a></li></ul>
View
31 config/router.rb
@@ -1,17 +1,26 @@
Merb.logger.info("Compiling routes...")
Merb::Router.prepare do
+
+ # http://localhost:4000/
+ # http://localhost:4000/en/
+ # http://localhost:4000/fr
+ # http://localhost:4000/table-of-contents
+ # http://localhost:4000/en/table-of-contents
+ # http://localhost:4000/getting-started/install-instructions
+ # http://localhost:4000/en/getting-started/install-instructions
- match('(/:language)/table-of-contents',
- :language => /^[a-z]{2}$/).
- to(:controller => 'pages', :action => 'index').name(:toc)
-
+ match('(/:language)/table-of-contents',
+ :language => /^[a-z]{2}$/).to(:controller => 'pages', :action => 'index').name(:toc)
+
match('(/:language)/:chapter(/:page_name)',
:language => /^[a-z]{2}$/,
- :chapter => /[^\/]{3,}/).
- to(:controller => 'pages', :action => 'show').name(:page)
-
- # default_routes
-
- match('/(:language)', :language => /^[a-z]{2}$/).
- to(:controller => 'pages', :action => 'index')
+ :chapter => /[^\/]{3,}/).to(:controller => 'pages', :action => 'show').name(:page)
+
+ match('/(:language)', :language => /^[a-z]{2}$/).to(:controller => 'pages', :action => 'index')
+
+ # match('(/:language)(/)', :language => /^[a-z]{2}$/).to(:controller => "pages") do
+ # match(":chapter(/:page_name)", :chapter => %r'[^/.;?]{3,}').to(:action => "show").name(:page)
+ # match("(table-of-contents)").name(:toc)
+ # end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.