#148: Support sorting a limited range of accented characters in the glossary.

This commit is contained in:
Georg Brandl 2011-01-04 19:23:47 +01:00
parent 5c0c465db2
commit 9624ff5e10
2 changed files with 4 additions and 3 deletions

View File

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

View File

@ -10,6 +10,7 @@
"""
import re
import unicodedata
from docutils import nodes
from docutils.parsers.rst import directives
@ -250,7 +251,7 @@ class Glossary(Directive):
li.insert(0, indexnode)
items.append((termtext, li))
if 'sorted' in self.options:
items.sort(key=lambda x: x[0].lower())
items.sort(key=lambda x: unicodedata.normalize('NFD', x[0].lower()))
new_dl.extend(item[1] for item in items)
node.children = [new_dl]
return [node]