diff --git a/Rakefile b/Rakefile index 57646c1c..124b4c95 100644 --- a/Rakefile +++ b/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 diff --git a/app/controllers/pages.rb b/app/controllers/pages.rb index 462e6aaf..04e83851 100644 --- a/app/controllers/pages.rb +++ b/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 diff --git a/app/helpers/global_helpers.rb b/app/helpers/global_helpers.rb index 8e926a53..dc552f63 100644 --- a/app/helpers/global_helpers.rb +++ b/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. diff --git a/book-content/en/0-front-matter/2-contributors.markdown b/book-content/en/0-front-matter/2-contributors.markdown index 66b2722d..0ccc2fb1 100644 --- a/book-content/en/0-front-matter/2-contributors.markdown +++ b/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/) \ No newline at end of file +* [Arthur Zapparoli ](http://arthurgeek.net/) +* [Jai-Gouk Kim ](http://jaigouk.blogspot.com/) \ No newline at end of file diff --git a/book-content/en/4-interacting-with-the-database-active_record/toc.markdown b/book-content/en/4-interacting-with-the-database-active_record/toc.markdown index 20088532..fbcc7f4e 100644 --- a/book-content/en/4-interacting-with-the-database-active_record/toc.markdown +++ b/book-content/en/4-interacting-with-the-database-active_record/toc.markdown @@ -2,4 +2,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/book-content/en/5-interacting-with-the-database-sequel/toc.markdown b/book-content/en/5-interacting-with-the-database-sequel/toc.markdown index 40600f09..29b8124d 100644 --- a/book-content/en/5-interacting-with-the-database-sequel/toc.markdown +++ b/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) + + + + + + + + + \ No newline at end of file diff --git a/book-content/en/5-testing-your-application/toc.markdown b/book-content/en/5-testing-your-application/toc.markdown deleted file mode 100644 index 3768d838..00000000 --- a/book-content/en/5-testing-your-application/toc.markdown +++ /dev/null @@ -1,9 +0,0 @@ -# testing-your-application - - - - - - - - \ No newline at end of file diff --git a/book-content/en/6-merb-more/toc.markdown b/book-content/en/6-merb-more/toc.markdown deleted file mode 100644 index 69a71221..00000000 --- a/book-content/en/6-merb-more/toc.markdown +++ /dev/null @@ -1,11 +0,0 @@ -# merb-more - - - - - - - - - - \ No newline at end of file diff --git a/config/router.rb b/config/router.rb index 4befd1b4..dd0324ba 100644 --- a/config/router.rb +++ b/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 \ No newline at end of file