aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/rails_guides/indexer.rb
diff options
context:
space:
mode:
authorAleksander Pohl <apohllo@o2.pl>2010-05-29 21:36:13 +0200
committerXavier Noria <fxn@hashref.com>2010-08-26 01:05:52 +0200
commitee7507b38e14c39dd21aef581cffbe5dc3bd273b (patch)
treedefcc5b88f1b387e4a38fe3e24a2fb2036ee0bbd /railties/guides/rails_guides/indexer.rb
parent4b07bc84759d2accfaa90f135d169261bc2ff32d (diff)
downloadrails-ee7507b38e14c39dd21aef581cffbe5dc3bd273b.tar.gz
rails-ee7507b38e14c39dd21aef581cffbe5dc3bd273b.tar.bz2
rails-ee7507b38e14c39dd21aef581cffbe5dc3bd273b.zip
- Fix non-ascii characters in headers
Signed-off-by: Xavier Noria <fxn@hashref.com>
Diffstat (limited to 'railties/guides/rails_guides/indexer.rb')
-rw-r--r--railties/guides/rails_guides/indexer.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/railties/guides/rails_guides/indexer.rb b/railties/guides/rails_guides/indexer.rb
index bd817786ed..fb46491817 100644
--- a/railties/guides/rails_guides/indexer.rb
+++ b/railties/guides/rails_guides/indexer.rb
@@ -1,5 +1,6 @@
require 'active_support/core_ext/object/blank'
require 'active_support/ordered_hash'
+require 'active_support/core_ext/string/inflections'
module RailsGuides
class Indexer
@@ -58,7 +59,7 @@ module RailsGuides
end
def title_to_idx(title)
- idx = title.strip.downcase.gsub(/\s+|_/, '-').delete('^a-z0-9-').sub(/^[^a-z]*/, '')
+ idx = title.strip.parameterize.sub(/^\d+/, '')
if warnings && idx.blank?
puts "BLANK ID: please put an explicit ID for section #{title}, as in h5(#my-id)"
end