mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
merge with 1.0
This commit is contained in:
6
CHANGES
6
CHANGES
@@ -58,6 +58,12 @@ Release 1.1 (in development)
|
||||
Release 1.0.6 (in development)
|
||||
==============================
|
||||
|
||||
* #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.
|
||||
|
||||
* #528: Observe :confval:`locale_dirs` when looking for the JS
|
||||
translations file.
|
||||
|
||||
|
||||
@@ -90,6 +90,13 @@ def main(argv):
|
||||
if err:
|
||||
return 1
|
||||
|
||||
# likely encoding used for command-line arguments
|
||||
try:
|
||||
locale = __import__('locale') # due to submodule of the same name
|
||||
likely_encoding = locale.getpreferredencoding()
|
||||
except Exception:
|
||||
likely_encoding = None
|
||||
|
||||
buildername = None
|
||||
force_all = freshenv = warningiserror = use_pdb = False
|
||||
status = sys.stdout
|
||||
@@ -129,7 +136,11 @@ def main(argv):
|
||||
try:
|
||||
val = int(val)
|
||||
except ValueError:
|
||||
pass
|
||||
if likely_encoding:
|
||||
try:
|
||||
val = val.decode(likely_encoding)
|
||||
except UnicodeError:
|
||||
pass
|
||||
confoverrides[key] = val
|
||||
elif opt == '-A':
|
||||
try:
|
||||
@@ -141,7 +152,11 @@ def main(argv):
|
||||
try:
|
||||
val = int(val)
|
||||
except ValueError:
|
||||
pass
|
||||
if likely_encoding:
|
||||
try:
|
||||
val = val.decode(likely_encoding)
|
||||
except UnicodeError:
|
||||
pass
|
||||
confoverrides['html_context.%s' % key] = val
|
||||
elif opt == '-n':
|
||||
confoverrides['nitpicky'] = True
|
||||
|
||||
@@ -150,12 +150,12 @@ class DefExpr(object):
|
||||
return None
|
||||
|
||||
def split_owner(self):
|
||||
"""Nodes returned by :meth:`get_name` can split off their owning parent.
|
||||
|
||||
This function returns the owner and the name as a tuple of two items.
|
||||
If a node does not support it, :exc:`NotImplementedError` is raised.
|
||||
"""Nodes returned by :meth:`get_name` can split off their
|
||||
owning parent. This function returns the owner and the
|
||||
name as a tuple of two items. If a node does not support
|
||||
it, it returns None as owner and self as name.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
return None, self
|
||||
|
||||
def prefix(self, prefix):
|
||||
"""Prefix a name node (a node returned by :meth:`get_name`)."""
|
||||
@@ -173,9 +173,6 @@ class PrimaryDefExpr(DefExpr):
|
||||
def get_name(self):
|
||||
return self
|
||||
|
||||
def split_owner(self):
|
||||
return None, self
|
||||
|
||||
def prefix(self, prefix):
|
||||
if isinstance(prefix, PathDefExpr):
|
||||
prefix = prefix.clone()
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -18,6 +18,7 @@ import codecs
|
||||
import imghdr
|
||||
import string
|
||||
import posixpath
|
||||
import unicodedata
|
||||
import cPickle as pickle
|
||||
from os import path
|
||||
from glob import glob
|
||||
@@ -1531,7 +1532,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
|
||||
@@ -1574,7 +1575,7 @@ class BuildEnvironment:
|
||||
k, v = item
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user