Georg Brandl avatar Georg Brandl committed c2fbf3a

Fixes #892: Fix single-HTML builder misbehaving with the master document in a subdirectory.

Comments (0)

Files changed (2)

 
 * #870: Fix spurious KeyErrors when removing documents.
 
+* #892: Fix single-HTML builder misbehaving with the master document in a
+  subdirectory.
+
 
 Release 1.1.2 (Nov 1, 2011) -- 1.1.1 is a silly version number anyway!
 ======================================================================

sphinx/builders/html.py

         ctx = self.globalcontext.copy()
         # current_page_name is backwards compatibility
         ctx['pagename'] = ctx['current_page_name'] = pagename
+        default_baseuri = self.get_target_uri(pagename)
+        # in the singlehtml builder, default_baseuri still contains an #anchor
+        # part, which relative_uri doesn't really like...
+        default_baseuri = default_baseuri.rsplit('#', 1)[0]
 
-        def pathto(otheruri, resource=False,
-                   baseuri=self.get_target_uri(pagename)):
+        def pathto(otheruri, resource=False, baseuri=default_baseuri):
             if resource and '://' in otheruri:
                 # allow non-local resources given by scheme
                 return otheruri
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.