diff options
author | Joaquin Anton <janton@nvidia.com> | 2021-03-01 12:32:31 +0300 |
---|---|---|
committer | Joaquin Anton <janton@nvidia.com> | 2021-03-01 12:32:31 +0300 |
commit | 2c6c1469eedbc3f975e308cda47d746e5087938e (patch) | |
tree | 31743c36c3d9c307eb3e00a0685d3d51898f2d53 /sphinx/environment | |
parent | 3f62d2f294bb6e066325bc8f1a58f6a565c9b3c5 (diff) |
Apply code review suggestions
Signed-off-by: Joaquin Anton <janton@nvidia.com>
Diffstat (limited to 'sphinx/environment')
-rw-r--r-- | sphinx/environment/collectors/title.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sphinx/environment/collectors/title.py b/sphinx/environment/collectors/title.py index 00832ae43..28e967427 100644 --- a/sphinx/environment/collectors/title.py +++ b/sphinx/environment/collectors/title.py @@ -39,10 +39,9 @@ class TitleCollector(EnvironmentCollector): longtitlenode = titlenode # explicit title set with title directive; use this only for # the <title> tag in HTML output - explicit_title = nodes.Text(doctree['title']) if 'title' in doctree else None - if explicit_title: + if 'title' in doctree: longtitlenode = nodes.title() - longtitlenode += explicit_title + longtitlenode += nodes.Text(doctree['title']) # look for first section title and use that as the title for node in doctree.traverse(nodes.section): visitor = SphinxContentsFilter(doctree) @@ -51,7 +50,7 @@ class TitleCollector(EnvironmentCollector): break else: # document has no title - titlenode += explicit_title or nodes.Text('<no title>') + titlenode += nodes.Text(doctree.get('title', '<no title>')) app.env.titles[app.env.docname] = titlenode app.env.longtitles[app.env.docname] = longtitlenode |