diff options
author | Takayuki Hirai <gen@pjxiao.net> | 2015-03-30 19:54:17 +0900 |
---|---|---|
committer | Takayuki Hirai <gen@pjxiao.net> | 2015-03-30 19:55:49 +0900 |
commit | 144fb2634dda00738c2b05f33de0ca7864bae97c (patch) | |
tree | a0693ec60d6bff4ebe80c2d23daf91ef6c6853ba | |
parent | 629961ebfefbe92becef6384fb48238bfc3dca2f (diff) | |
download | sphinx-git-144fb2634dda00738c2b05f33de0ca7864bae97c.tar.gz |
Fix #1793: Add new line before first item of list
-rw-r--r-- | sphinx/writers/text.py | 3 | ||||
-rw-r--r-- | tests/roots/test-build-text/listitems.txt | 4 | ||||
-rw-r--r-- | tests/test_build_text.py | 12 |
3 files changed, 19 insertions, 0 deletions
diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index ad2d8bbbc..12f4af1e8 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -711,6 +711,9 @@ class TextTranslator(nodes.NodeVisitor): def _visit_admonition(self, node): self.new_state(2) + if isinstance(node.children[0], nodes.Sequential): + self.add_text(self.nl) + def _make_depart_admonition(name): def depart_admonition(self, node): self.end_state(first=admonitionlabels[name] + ': ') diff --git a/tests/roots/test-build-text/listitems.txt b/tests/roots/test-build-text/listitems.txt new file mode 100644 index 000000000..f0952d8c6 --- /dev/null +++ b/tests/roots/test-build-text/listitems.txt @@ -0,0 +1,4 @@ +.. seealso:: + + * item 1 + * item 2 diff --git a/tests/test_build_text.py b/tests/test_build_text.py index 014deeca3..5a1ec227f 100644 --- a/tests/test_build_text.py +++ b/tests/test_build_text.py @@ -99,3 +99,15 @@ def test_table_with_empty_cell(app, status, warning): assert lines[4] == "+-------+-------+" assert lines[5] == "| XXX | |" assert lines[6] == "+-------+-------+" + + +@with_text_app() +def test_list_items_in_admonition(app, status, warning): + app.builder.build_update() + result = (app.outdir / 'listitems.txt').text(encoding='utf-8') + lines = [line.rstrip() for line in result.splitlines()] + assert lines[0] == "See also:" + assert lines[1] == "" + assert lines[2] == " * item 1" + assert lines[3] == "" + assert lines[4] == " * item 2" |