diff options
Diffstat (limited to 'sphinx/writers/text.py')
-rw-r--r-- | sphinx/writers/text.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index 2463920ef..7032208ea 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -281,8 +281,11 @@ class TextTranslator(nodes.NodeVisitor): char = '^' text = ''.join(x[1] for x in self.states.pop() if x[0] == -1) self.stateindent.pop() - self.states[-1].append( - (0, ['', text, '%s' % (char * column_width(text)), ''])) + title = ['', text, '%s' % (char * column_width(text)), ''] + if len(self.states) == 2 and len(self.states[-1]) == 0: + # remove an empty line before title if it is first section title in the document + title.pop(0) + self.states[-1].append((0, title)) def visit_subtitle(self, node): pass @@ -309,6 +312,12 @@ class TextTranslator(nodes.NodeVisitor): # XXX: wrap signatures in a way that makes sense self.end_state(wrap=False, end=None) + def visit_desc_signature_line(self, node): + pass + + def depart_desc_signature_line(self, node): + self.add_text('\n') + def visit_desc_name(self, node): pass |