diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-12-22 12:47:30 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-12-22 12:47:30 +0300 |
commit | 5640cf879f91c8ca5e71b68ab5a5fd24b536703a (patch) | |
tree | 6fc2107d8adc1ade4f9a8ca260db4e156fdde609 /sphinx/writers/texinfo.py | |
parent | e83bb29789a093c651a255a509430a03346a5afb (diff) | |
parent | 43c089fd28dfdc33cc67b364724db51d3f5c1804 (diff) |
Merge branch '2.0'
Diffstat (limited to 'sphinx/writers/texinfo.py')
-rw-r--r-- | sphinx/writers/texinfo.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sphinx/writers/texinfo.py b/sphinx/writers/texinfo.py index fd33c9fe4..2a631f176 100644 --- a/sphinx/writers/texinfo.py +++ b/sphinx/writers/texinfo.py @@ -240,7 +240,7 @@ class TexinfoTranslator(SphinxTranslator): title = self.settings.title # type: str if not title: title_node = self.document.next_node(nodes.title) - title = (title_node and title_node.astext()) or '<untitled>' + title = title_node.astext() if title_node else '<untitled>' elements['title'] = self.escape_id(title) or '<untitled>' # filename if not elements['filename']: @@ -290,7 +290,7 @@ class TexinfoTranslator(SphinxTranslator): # each section is also a node for section in self.document.traverse(nodes.section): title = cast(nodes.TextElement, section.next_node(nodes.Titular)) - name = (title and title.astext()) or '<untitled>' + name = title.astext() if title else '<untitled>' section['node_name'] = add_node_name(name) def collect_node_menus(self) -> None: @@ -304,7 +304,7 @@ class TexinfoTranslator(SphinxTranslator): node_menus[node['node_name']] = entries # try to find a suitable "Top" node title = self.document.next_node(nodes.title) - top = (title and title.parent) or self.document + top = title.parent if title else self.document if not isinstance(top, (nodes.document, nodes.section)): top = self.document if top is not self.document: |