Skip to content

Commit

Permalink
fixed the tocs and specs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattetti committed Jan 23, 2009
1 parent 4af777a commit 7fe2a79
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -51,7 +51,7 @@ task :create_chapter_tocs do
end end
end end
else 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| chapters.each do |chapter|
save_chapter_toc(chapter, ENV["LANG"]) save_chapter_toc(chapter, ENV["LANG"])
end end
Expand Down
1 change: 1 addition & 0 deletions app/controllers/pages.rb
Expand Up @@ -14,6 +14,7 @@ def show


def table_of_content def table_of_content
toc_file = Dir["#{Merb.root}/book-content/#{language}/toc.*"].entries.first toc_file = Dir["#{Merb.root}/book-content/#{language}/toc.*"].entries.first
raise NotFound unless toc_file
text = File.open(toc_file).read text = File.open(toc_file).read
render ::Maruku::new(text).to_html render ::Maruku::new(text).to_html
end end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/global_helpers.rb
Expand Up @@ -22,7 +22,7 @@ def rtl_support_class


# Returns links to the previous and next pages. # Returns links to the previous and next pages.
def page_nav_links(format = 'markdown') 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 = []
links << previous_page_url links << previous_page_url
# Stick a link to the TOC in the middle of the array. # Stick a link to the TOC in the middle of the array.
Expand Down
5 changes: 3 additions & 2 deletions book-content/en/0-front-matter/2-contributors.markdown
Expand Up @@ -13,8 +13,9 @@ Thank you all!
* [Yehuda Katz ](http://yehudakatz.com) * [Yehuda Katz ](http://yehudakatz.com)
* [Makoto Kuwata ](http://www.kuwata-lab.com/) * [Makoto Kuwata ](http://www.kuwata-lab.com/)
* [Rich Morin ](http://cfcl.com/rdm) * [Rich Morin ](http://cfcl.com/rdm)
* [Carlo Pecchia ](http://carlopecchia.eu) * [Carlo Pecchia ](http://carlopecchia.eu)
* [Markus Prinz ](http://blog.nuclearsquid.com/) * [Markus Prinz ](http://blog.nuclearsquid.com/)
* [Foy Savas ](http://foysavas.com/) * [Foy Savas ](http://foysavas.com/)
* [Kurt Schrader ](http://kurt.karmalab.org/) * [Kurt Schrader ](http://kurt.karmalab.org/)
* [Arthur Zapparoli ](http://arthurgeek.net/) * [Arthur Zapparoli ](http://arthurgeek.net/)
* [Jai-Gouk Kim ](http://jaigouk.blogspot.com/)
Expand Up @@ -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/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>
@@ -1,10 +1,13 @@
# interacting-with-the-database-sequel # interacting-with-the-database-sequel


1. [Installation and setup](/interacting-with-the-database-sequel/setting-up) <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>
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/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>
9 changes: 0 additions & 9 deletions book-content/en/5-testing-your-application/toc.markdown

This file was deleted.

11 changes: 0 additions & 11 deletions book-content/en/6-merb-more/toc.markdown

This file was deleted.

31 changes: 20 additions & 11 deletions config/router.rb
@@ -1,17 +1,26 @@
Merb.logger.info("Compiling routes...") Merb.logger.info("Compiling routes...")
Merb::Router.prepare do 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', match('(/:language)/table-of-contents',
:language => /^[a-z]{2}$/). :language => /^[a-z]{2}$/).to(:controller => 'pages', :action => 'index').name(:toc)
to(:controller => 'pages', :action => 'index').name(:toc)

match('(/:language)/:chapter(/:page_name)', match('(/:language)/:chapter(/:page_name)',
:language => /^[a-z]{2}$/, :language => /^[a-z]{2}$/,
:chapter => /[^\/]{3,}/). :chapter => /[^\/]{3,}/).to(:controller => 'pages', :action => 'show').name(:page)
to(:controller => 'pages', :action => 'show').name(:page)

match('/(:language)', :language => /^[a-z]{2}$/).to(:controller => 'pages', :action => 'index')
# default_routes

# match('(/:language)(/)', :language => /^[a-z]{2}$/).to(:controller => "pages") do
match('/(:language)', :language => /^[a-z]{2}$/). # match(":chapter(/:page_name)", :chapter => %r'[^/.;?]{3,}').to(:action => "show").name(:page)
to(:controller => 'pages', :action => 'index') # match("(table-of-contents)").name(:toc)
# end

end end

0 comments on commit 7fe2a79

Please sign in to comment.