Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-07-18 09:37:03 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-07-18 09:52:57 +0300
commit66da2664411ded2f23a4aae32f708ec14c47e3a8 (patch)
tree753720537aee6c544ee46cee92d60094f8a433ee /sphinx/environment
parent4ec6cbe341fd84468c448e20082c778043bbea4b (diff)
Fix #2050: Symbols sections are appeared twice in the index page
Multibyte symbols are categorized to independent symbols section different to single byte symbols. This integrate them to a single section.
Diffstat (limited to 'sphinx/environment')
-rw-r--r--sphinx/environment/adapters/indexentries.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/sphinx/environment/adapters/indexentries.py b/sphinx/environment/adapters/indexentries.py
index 5af213932..b13ac97c3 100644
--- a/sphinx/environment/adapters/indexentries.py
+++ b/sphinx/environment/adapters/indexentries.py
@@ -98,9 +98,8 @@ class IndexEntries:
for subentry in indexentry[1].values():
subentry[0].sort(key=keyfunc0) # type: ignore
- # 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: Tuple[str, List]) -> Tuple[str, str]:
+ # sort the index entries
+ def keyfunc(entry: Tuple[str, List]) -> Tuple[Tuple[int, str], str]:
key, (void, void, category_key) = entry
if category_key:
# using specified category key to sort
@@ -108,11 +107,16 @@ class IndexEntries:
lckey = unicodedata.normalize('NFD', key.lower())
if lckey.startswith('\N{RIGHT-TO-LEFT MARK}'):
lckey = lckey[1:]
+
if lckey[0:1].isalpha() or lckey.startswith('_'):
- lckey = chr(127) + lckey
+ # put non-symbol characters at the folloing group (1)
+ sortkey = (1, lckey)
+ else:
+ # put symbols at the front of the index (0)
+ sortkey = (0, lckey)
# ensure a determinstic order *within* letters by also sorting on
# the entry itself
- return (lckey, entry[0])
+ return (sortkey, entry[0])
newlist = sorted(new.items(), key=keyfunc)
if group_entries: