aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/rails_guides/indexer.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2009-02-22 00:29:11 +0100
committerXavier Noria <fxn@hashref.com>2009-02-22 00:29:11 +0100
commit247b9563ac81f6e66bc3c5af8e280adad66258a4 (patch)
treec4f992f6957f6befe8d137090a4b802f21884154 /railties/guides/rails_guides/indexer.rb
parentbd45029f5552e5a91e0c4a1aa480329c17753277 (diff)
downloadrails-247b9563ac81f6e66bc3c5af8e280adad66258a4.tar.gz
rails-247b9563ac81f6e66bc3c5af8e280adad66258a4.tar.bz2
rails-247b9563ac81f6e66bc3c5af8e280adad66258a4.zip
let the indexer pass element IDs to the guides generator to avoid coupling, links to sections whose title has textile markup are fixed as well
Diffstat (limited to 'railties/guides/rails_guides/indexer.rb')
-rw-r--r--railties/guides/rails_guides/indexer.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/railties/guides/rails_guides/indexer.rb b/railties/guides/rails_guides/indexer.rb
index 52809829e2..7cb254d0b0 100644
--- a/railties/guides/rails_guides/indexer.rb
+++ b/railties/guides/rails_guides/indexer.rb
@@ -29,13 +29,17 @@ module RailsGuides
return level_hash
elsif level == current_level
index = counters.join(".")
- bookmark = '#' + title.gsub(/[^a-z0-9\-_\+]+/i, '').underscore.dasherize
+ bookmark = '#' + title.gsub(/[^a-z0-9\-_]+/i, '').underscore.dasherize
raise "Parsing Fail" unless @result.sub!(matched, "h#{level}(#{bookmark}). #{index}#{title}")
+ key = {
+ :title => title,
+ :id => bookmark
+ }
# Recurse
counters << 1
- level_hash[title.strip] = process(s.post_match, current_level + 1, counters)
+ level_hash[key] = process(s.post_match, current_level + 1, counters)
counters.pop
# Increment the current level