diff options
author | Martin Liska <mliska@suse.cz> | 2021-06-16 09:21:46 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2021-06-16 09:30:08 +0200 |
commit | b23eefa03b56717c4be973d5f89044517dca8f8c (patch) | |
tree | 65473d0538ffbfc7005aa3a344b6e1b0eeffd60f /sphinx/writers/manpage.py | |
parent | f14561da80c263b867b51e27a75c4f9cdacfeb29 (diff) | |
download | sphinx-git-b23eefa03b56717c4be973d5f89044517dca8f8c.tar.gz |
Fix :samp:`{var}` in manual pages.
When a samp begins with a variable part, it is not unwrapped for manual
pages.
Fixes #1860.
Diffstat (limited to 'sphinx/writers/manpage.py')
-rw-r--r-- | sphinx/writers/manpage.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sphinx/writers/manpage.py b/sphinx/writers/manpage.py index 3f0eea5eb..95e0f5658 100644 --- a/sphinx/writers/manpage.py +++ b/sphinx/writers/manpage.py @@ -59,13 +59,16 @@ class NestedInlineTransform: for node in self.document.traverse(matcher): # type: TextElement if any(matcher(subnode) for subnode in node): pos = node.parent.index(node) - for subnode in reversed(node[1:]): + for subnode in reversed(list(node)): node.remove(subnode) if matcher(subnode): node.parent.insert(pos + 1, subnode) else: newnode = node.__class__('', '', subnode, **node.attributes) node.parent.insert(pos + 1, newnode) + # move node if all children became siblings of the node + if not len(node): + node.parent.remove(node) class ManualPageTranslator(SphinxTranslator, BaseTranslator): |