mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
🐛 Fix singlehtml target uris to be same-document references (#11970)
Before this change, target_uris would be generated as `index.html#foo`. This makes it difficult to rename the generated document and can require reloading the document when following a link. After this change, they are just `#foo`, which avoids the above problems.
This commit is contained in:
parent
c7c02002e5
commit
413e740dca
@ -147,6 +147,9 @@ Bugs fixed
|
||||
* #12040: HTML Search: Ensure that document titles that are partially-matched by
|
||||
the user search query are included in search results.
|
||||
Patch by James Addison.
|
||||
* #11970: singlehtml builder: make target URIs to be same-document references in
|
||||
the sense of :rfc:`RFC 3986, §4.4 <3986#section-4.4>`, e.g., ``index.html#foo``
|
||||
becomes ``#foo``. Patch by eanorige.
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
@ -41,8 +41,7 @@ class SingleFileHTMLBuilder(StandaloneHTMLBuilder):
|
||||
def get_target_uri(self, docname: str, typ: str | None = None) -> str:
|
||||
if docname in self.env.all_docs:
|
||||
# all references are on the same page...
|
||||
return self.config.root_doc + self.out_suffix + \
|
||||
'#document-' + docname
|
||||
return '#document-' + docname
|
||||
else:
|
||||
# chances are this is a html_additional_page
|
||||
return docname + self.out_suffix
|
||||
|
Loading…
Reference in New Issue
Block a user