mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Add suffix to HTML context. Fixes #1873
This commit is contained in:
parent
aefab514e2
commit
c22f5beb75
@ -399,3 +399,8 @@ are in HTML form), these variables are also available:
|
|||||||
|
|
||||||
* ``includehidden`` (``False`` by default): if true, the TOC tree will also
|
* ``includehidden`` (``False`` by default): if true, the TOC tree will also
|
||||||
contain hidden entries.
|
contain hidden entries.
|
||||||
|
|
||||||
|
.. data:: page_source_suffix
|
||||||
|
|
||||||
|
The suffix of the file that was rendered. Since we support a list of :confval:`source_suffix`,
|
||||||
|
this will allow you to properly link to the original source file.
|
||||||
|
@ -408,6 +408,9 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
# metadata for the document
|
# metadata for the document
|
||||||
meta = self.env.metadata.get(docname)
|
meta = self.env.metadata.get(docname)
|
||||||
|
|
||||||
|
# Suffix for the document
|
||||||
|
source_suffix = '.' + self.env.doc2path(docname).split('.')[-1]
|
||||||
|
|
||||||
# local TOC and global TOC tree
|
# local TOC and global TOC tree
|
||||||
self_toc = self.env.get_toc_for(docname, self)
|
self_toc = self.env.get_toc_for(docname, self)
|
||||||
toc = self.render_partial(self_toc)['fragment']
|
toc = self.render_partial(self_toc)['fragment']
|
||||||
@ -425,6 +428,7 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
toc = toc,
|
toc = toc,
|
||||||
# only display a TOC if there's more than one item to show
|
# only display a TOC if there's more than one item to show
|
||||||
display_toc = (self.env.toc_num_entries[docname] > 1),
|
display_toc = (self.env.toc_num_entries[docname] > 1),
|
||||||
|
page_source_suffix = source_suffix,
|
||||||
)
|
)
|
||||||
|
|
||||||
def write_doc(self, docname, doctree):
|
def write_doc(self, docname, doctree):
|
||||||
|
Loading…
Reference in New Issue
Block a user