Commits

Georg Brandl  committed fe99dad Merge

merge with 0.6

  • Participants
  • Parent commits d1a5c52, b9b969d

Comments (0)

Files changed (4)

 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.
 

File sphinx/builders/html.py

         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 ''

File sphinx/directives/other.py

                 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]

File sphinx/environment.py

 
 # 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([
 
         # 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
             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)
         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():