diff options
author | grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2013-03-08 09:03:16 +0000 |
---|---|---|
committer | grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2013-03-08 09:03:16 +0000 |
commit | 933df8c51f865e92068acd8335cd16172cb03ca8 (patch) | |
tree | 09fef7186b1c3719a042fdadeb4da33627db6af5 | |
parent | c5a1ea27613ac7c286f48b6f0fda3b83d43fc8c2 (diff) | |
download | docutils-933df8c51f865e92068acd8335cd16172cb03ca8.tar.gz |
Fix [3607063] handle lines starting with a period.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7626 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r-- | HISTORY.txt | 1 | ||||
-rw-r--r-- | docutils/writers/manpage.py | 6 | ||||
-rw-r--r-- | test/functional/expected/standalone_rst_manpage.man | 2 | ||||
-rw-r--r-- | test/test_writers/test_manpage.py | 5 |
4 files changed, 9 insertions, 5 deletions
diff --git a/HISTORY.txt b/HISTORY.txt index 7f236c041..27a05cf98 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -64,6 +64,7 @@ Changes Since 0.10 * docutils/writers/manpage.py + - Fix [3607063] handle lines starting with a period. - Fix option separating comma was bold (thanks to Bill Morris). Release 0.10 (2012-12-16) diff --git a/docutils/writers/manpage.py b/docutils/writers/manpage.py index 71a4aa1a9..7af7cbc5f 100644 --- a/docutils/writers/manpage.py +++ b/docutils/writers/manpage.py @@ -289,10 +289,10 @@ class Translator(nodes.NodeVisitor): text = text.replace(in_char, out_markup) # unicode text = self.deunicode(text) + # prevent interpretation of "." at line start + if text[0] == '.': + text = '\\&' + text if self._in_literal: - # prevent interpretation of "." at line start - if text[0] == '.': - text = '\\&' + text text = text.replace('\n.', '\n\\&.') self.body.append(text) diff --git a/test/functional/expected/standalone_rst_manpage.man b/test/functional/expected/standalone_rst_manpage.man index 1e383791d..fbc9272eb 100644 --- a/test/functional/expected/standalone_rst_manpage.man +++ b/test/functional/expected/standalone_rst_manpage.man @@ -93,7 +93,7 @@ bullet lists .IP 3. 3 number lists .IP 4. 3 -math: The LaTeX source is shown, e.g. \fBn! + \esin(x_n^2)\fP. +math: The LaTeX source is shown, e.g. \fBn! + \esin(x_n^2)\fP\&. .UNINDENT .sp Discussion is still open. diff --git a/test/test_writers/test_manpage.py b/test/test_writers/test_manpage.py index da9a77b3c..3bbfbcbe6 100644 --- a/test/test_writers/test_manpage.py +++ b/test/test_writers/test_manpage.py @@ -138,6 +138,7 @@ With mixed case. something important +. period at line start. """, r""".\" Man page generated from reStructuredText. . @@ -194,6 +195,8 @@ bull and list something important .UNINDENT .UNINDENT +.sp +\&. period at line start. .SH AUTHOR someone@somewhere.net @@ -292,7 +295,7 @@ bla bla bla .UNINDENT .INDENT 0.0 .TP -.B . +.B \&. bla bla bla .UNINDENT .INDENT 0.0 |