mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
#148: Support sorting a limited range of accented characters in the glossary.
This commit is contained in:
parent
5c0c465db2
commit
9624ff5e10
4
CHANGES
4
CHANGES
@ -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.
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user