Georg Brandl avatar Georg Brandl committed a401992

#4251: some module links didn't have proper anchors.

Comments (0)

Files changed (2)

 Bugs fixed
 ----------
 
+* Fix a problem with module links not being generated in LaTeX output.
+
 * Fix the handling of images in different directories.
 
 * Support option lists in the text writer.  Make sure that dashes

sphinx/environment.py

                 elif typ == 'mod':
                     docname, synopsis, platform, deprecated = \
                         self.modules.get(target, ('','','', ''))
-                    # just link to an anchor if there are multiple modules in one file
-                    # because the anchor is generally below the heading which is ugly
-                    # but can't be helped easily
-                    anchor = ''
                     if not docname:
                         newnode = builder.app.emit_firstresult('missing-reference',
                                                                self, node, contnode)
                         # don't link to self
                         newnode = contnode
                     else:
-                        if len(self.filemodules[docname]) > 1:
-                            anchor = '#' + 'module-' + target
                         newnode = nodes.reference('', '')
-                        newnode['refuri'] = (
-                            builder.get_relative_uri(fromdocname, docname) + anchor)
+                        newnode['refuri'] = builder.get_relative_uri(
+                            fromdocname, docname) + '#module-' + target
                         newnode['reftitle'] = '%s%s%s' % (
                             (platform and '(%s) ' % platform),
                             synopsis, (deprecated and ' (deprecated)' or ''))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.