Commits

Georg Brandl committed ec6e71f

#383: Support sorting a limited range of accented characters in the general index.

Comments (0)

Files changed (2)

 Release 1.0.6 (in development)
 ==============================
 
+* #383: Support sorting a limited range of accented characters
+  in the general index.
+
 * #570: Try decoding ``-D`` and ``-A`` command-line arguments with
   the locale's preferred encoding.
 

sphinx/environment.py

 import codecs
 import imghdr
 import string
+import unicodedata
 import cPickle as pickle
 from os import path
 from glob import glob
         # sort the index entries; put all symbols at the front, even those
         # following the letters in ASCII, this is where the chr(127) comes from
         def keyfunc(entry, lcletters=string.ascii_lowercase + '_'):
-            lckey = entry[0].lower()
+            lckey = unicodedata.normalize('NFD', entry[0].lower())
             if lckey[0:1] in lcletters:
                 return chr(127) + lckey
             return lckey
             # hack: mutating the subitems dicts to a list in the keyfunc
             v[1] = sorted((si, se) for (si, (se, void)) in v[1].iteritems())
             # now calculate the key
-            letter = k[0].upper()
+            letter = unicodedata.normalize('NFD', k[0])[0].upper()
             if letter in letters:
                 return letter
             else: