mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Use explicit title for titlenode, when no title is provided
Signed-off-by: Joaquin Anton <janton@nvidia.com>
This commit is contained in:
parent
f8878bb0b6
commit
3f62d2f294
@ -39,9 +39,10 @@ class TitleCollector(EnvironmentCollector):
|
||||
longtitlenode = titlenode
|
||||
# explicit title set with title directive; use this only for
|
||||
# the <title> tag in HTML output
|
||||
if 'title' in doctree:
|
||||
explicit_title = nodes.Text(doctree['title']) if 'title' in doctree else None
|
||||
if explicit_title:
|
||||
longtitlenode = nodes.title()
|
||||
longtitlenode += nodes.Text(doctree['title'])
|
||||
longtitlenode += explicit_title
|
||||
# look for first section title and use that as the title
|
||||
for node in doctree.traverse(nodes.section):
|
||||
visitor = SphinxContentsFilter(doctree)
|
||||
@ -50,7 +51,7 @@ class TitleCollector(EnvironmentCollector):
|
||||
break
|
||||
else:
|
||||
# document has no title
|
||||
titlenode += nodes.Text('<no title>')
|
||||
titlenode += explicit_title or nodes.Text('<no title>')
|
||||
app.env.titles[app.env.docname] = titlenode
|
||||
app.env.longtitles[app.env.docname] = longtitlenode
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user