From 17591ffe934db3fbef1a14bfb46b0b9f4e333595 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sat, 10 Mar 2012 19:24:03 +0100 Subject: [PATCH] Fixes #892: Fix single-HTML builder misbehaving with the master document in a subdirectory. --- CHANGES | 3 +++ sphinx/builders/html.py | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index b4f94996c..6ad21f088 100644 --- a/CHANGES +++ b/CHANGES @@ -48,6 +48,9 @@ Release 1.1.3 (in development) * #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! ====================================================================== diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index e90995424..818403744 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -698,9 +698,12 @@ class StandaloneHTMLBuilder(Builder): 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