lib/amber/render/table_of_contents.rb
def nameize(str)
      str = str.dup
      str.gsub!(/&(\w{2,6}?|#[0-9A-Fa-f]{2,6});/,'') # remove html entitities
      str.gsub!(/[^- [[:word:]]]/u, '') # remove non-word characters (using unicode definition of a word char)
      str.strip!
      str.downcase!          # upper case characters in urls are confusing
      str.gsub!(/\ +/u, '-') # spaces to dashes, preferred separator char everywhere
      CGI.escape(str)
    end
def nameize(str)
      str = str.dup
      str.gsub!(/&(\w{2,6}?|#[0-9A-Fa-f]{2,6});/,'') # remove html entitities
      str.gsub!(/[^- [[:word:]]]/u, '') # remove non-word characters (using unicode definition of a word char)
      str.strip!
      str.downcase!          # upper case characters in urls are confusing
      str.gsub!(/\ +/u, '-') # spaces to dashes, preferred separator char everywhere
      CGI.escape(str)
    end
convert any string to one suitable for a url.
 resist the urge to translit non-ascii slugs to ascii.
 it is always much better to keep strings as utf8.