diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-07-24 17:49:45 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-07-24 17:49:45 +0300 |
commit | 327c1872841bc6a98aa766fc3d7ee921e6d3b658 (patch) | |
tree | d3424f7aadc4a3118eb7fb72e245b4fbe8391e58 /sphinx/environment | |
parent | dc63eaf196d37c70410d37c3d28297fb513f7f6d (diff) | |
parent | 5b096c42ff3a907fa7bcce3fa620209da16d40bd (diff) |
Merge branch '3.x'
Diffstat (limited to 'sphinx/environment')
-rw-r--r-- | sphinx/environment/__init__.py | 6 | ||||
-rw-r--r-- | sphinx/environment/adapters/indexentries.py | 14 |
2 files changed, 12 insertions, 8 deletions
diff --git a/sphinx/environment/__init__.py b/sphinx/environment/__init__.py index 6de352498..71cbcfbdf 100644 --- a/sphinx/environment/__init__.py +++ b/sphinx/environment/__init__.py @@ -370,11 +370,11 @@ class BuildEnvironment: # add catalog mo file dependency repo = CatalogRepository(self.srcdir, self.config.locale_dirs, self.config.language, self.config.source_encoding) + mo_paths = {c.domain: c.mo_path for c in repo.catalogs} for docname in self.found_docs: domain = docname_to_domain(docname, self.config.gettext_compact) - for catalog in repo.catalogs: - if catalog.domain == domain: - self.dependencies[docname].add(catalog.mo_path) + if domain in mo_paths: + self.dependencies[docname].add(mo_paths[domain]) except OSError as exc: raise DocumentError(__('Failed to scan documents in %s: %r') % (self.srcdir, exc)) from exc 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: |