From d9080b3eef11830c17ed44fd35d22753dce18b34 Mon Sep 17 00:00:00 2001 From: Andrey Golovizin Date: Mon, 28 Sep 2015 19:56:54 +0200 Subject: [PATCH] Omit empty URL targets in objects.inv --- sphinx/builders/html.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index 4880f3803e..79fd069029 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -843,7 +843,9 @@ class StandaloneHTMLBuilder(Builder): if anchor.endswith(name): # this can shorten the inventory by as much as 25% anchor = anchor[:-len(name)] + '$' - uri = self.get_target_uri(docname) + '#' + anchor + uri = self.get_target_uri(docname) + if anchor: + uri += '#' + anchor if dispname == name: dispname = u'-' f.write(compressor.compress(