diff options
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | sphinx/builders/html.py | 2 | ||||
-rw-r--r-- | sphinx/directives/other.py | 2 | ||||
-rw-r--r-- | sphinx/environment.py | 28 |
4 files changed, 21 insertions, 13 deletions
@@ -38,6 +38,8 @@ Release 1.0 (in development) Release 0.6.2 (in development) ============================== +* #167: Make glossary sorting case-independent. + * #196: Add a warning if an extension module doesn't have a ``setup()`` function. diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index c80b20a3..54327fa1 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -325,7 +325,7 @@ class StandaloneHTMLBuilder(Builder): parents.reverse() # title rendered as HTML - title = titles.get(docname) + title = self.env.longtitles.get(docname) title = title and self.render_partial(title)['title'] or '' # the name for the copied source sourcename = self.config.html_copy_source and docname + '.txt' or '' diff --git a/sphinx/directives/other.py b/sphinx/directives/other.py index 400a160e..d056f3dc 100644 --- a/sphinx/directives/other.py +++ b/sphinx/directives/other.py @@ -451,7 +451,7 @@ class Glossary(Directive): li.insert(0, indexnode) items.append((termtext, li)) if 'sorted' in self.options: - items.sort() + items.sort(key=lambda x: x[0].lower()) new_dl.extend(item[1] for item in items) node.children = [new_dl] return [node] diff --git a/sphinx/environment.py b/sphinx/environment.py index a896131b..1f25553e 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -59,7 +59,7 @@ default_settings = { # This is increased every time an environment attribute is added # or changed to properly invalidate pickle files. -ENV_VERSION = 29 +ENV_VERSION = 30 default_substitutions = set([ @@ -274,6 +274,8 @@ class BuildEnvironment: # TOC inventory self.titles = {} # docname -> title node + self.longtitles = {} # docname -> title node; only different if + # set differently with title directive self.tocs = {} # docname -> table of contents nodetree self.toc_num_entries = {} # docname -> number of real entries # used to determine when to show the TOC @@ -343,6 +345,7 @@ class BuildEnvironment: self.metadata.pop(docname, None) self.dependencies.pop(docname, None) self.titles.pop(docname, None) + self.longtitles.pop(docname, None) self.tocs.pop(docname, None) self.toc_secnumbers.pop(docname, None) self.toc_num_entries.pop(docname, None) @@ -785,20 +788,23 @@ class BuildEnvironment: and store that title in the environment. """ titlenode = nodes.title() - # explicit title set with title directive + longtitlenode = titlenode + # explicit title set with title directive; use this only for + # the <title> tag in HTML output if document.has_key('title'): - titlenode += nodes.Text(document['title']) + longtitlenode = nodes.title() + longtitlenode += nodes.Text(document['title']) # look for first section title and use that as the title + for node in document.traverse(nodes.section): + visitor = SphinxContentsFilter(document) + node[0].walkabout(visitor) + titlenode += visitor.get_entry_text() + break else: - for node in document.traverse(nodes.section): - visitor = SphinxContentsFilter(document) - node[0].walkabout(visitor) - titlenode += visitor.get_entry_text() - break - else: - # document has no title - titlenode += nodes.Text('<no title>') + # document has no title + titlenode += nodes.Text('<no title>') self.titles[docname] = titlenode + self.longtitles[docname] = longtitlenode def note_labels_from(self, docname, document): for name, explicit in document.nametypes.iteritems(): |