diff options
author | Georg Brandl <georg@python.org> | 2011-01-04 17:14:00 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2011-01-04 17:14:00 +0100 |
commit | 7733526dca13e6cedf7642d798c86aaa8652d4c2 (patch) | |
tree | 67812ce720a65628e665d10afb5639f48594b35b | |
parent | e1fc984b5d7ddf49bddf796ef672aaacd29b2f08 (diff) | |
download | sphinx-7733526dca13e6cedf7642d798c86aaa8652d4c2.tar.gz |
#383: Support sorting a limited range of accented characters in the general index.
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | sphinx/environment.py | 5 |
2 files changed, 6 insertions, 2 deletions
@@ -1,6 +1,9 @@ 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. diff --git a/sphinx/environment.py b/sphinx/environment.py index 549a553d..b0d64e4a 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -16,6 +16,7 @@ import types import codecs import imghdr import string +import unicodedata import cPickle as pickle from os import path from glob import glob @@ -1477,7 +1478,7 @@ class BuildEnvironment: # 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 @@ -1519,7 +1520,7 @@ class BuildEnvironment: # 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: |