Rev 5253: (lifeless) Fix standalone code blocks in help. (John Szakmeister) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon May 24 03:08:09 BST 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5253 [merge]
revision-id: pqm at pqm.ubuntu.com-20100524020802-hi1vckdctg1m4qq2
parent: pqm at pqm.ubuntu.com-20100524004939-y06jpldj8w0w8ryh
parent: john at szakmeister.net-20100520110533-f735qsq21ub0hwa5
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2010-05-24 03:08:02 +0100
message:
(lifeless) Fix standalone code blocks in help. (John Szakmeister)
modified:
bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
bzrlib/tests/test_help.py test_help.py-20070419045354-6q6rq15j9e2n5fna-1
=== modified file 'bzrlib/help_topics/__init__.py'
--- a/bzrlib/help_topics/__init__.py 2010-04-30 01:39:46 +0000
+++ b/bzrlib/help_topics/__init__.py 2010-05-20 11:04:58 +0000
@@ -882,6 +882,8 @@
def help_as_plain_text(text):
"""Minimal converter of reStructuredText to plain text."""
import re
+ # Remove the standalone code block marker
+ text = re.sub(r"(?m)^\s*::\n\s*$", "", text)
lines = text.splitlines()
result = []
for line in lines:
=== modified file 'bzrlib/tests/test_help.py'
--- a/bzrlib/tests/test_help.py 2010-05-07 04:25:37 +0000
+++ b/bzrlib/tests/test_help.py 2010-05-24 02:08:02 +0000
@@ -112,6 +112,12 @@
Example 2::
cmd arg2
+
+ A code block follows.
+
+ ::
+
+ bzr Demo something
"""
cmd = cmd_Demo()
helptext = cmd.get_help_text()
@@ -135,6 +141,10 @@
' Example 2:\n'
'\n'
' cmd arg2\n'
+ '\n'
+ ' A code block follows.\n'
+ '\n'
+ ' bzr Demo something\n'
'\n')
helptext = cmd.get_help_text(plain=False)
self.assertEquals(helptext,
@@ -156,6 +166,12 @@
' Example 2::\n'
'\n'
' cmd arg2\n'
+ '\n'
+ ' A code block follows.\n'
+ '\n'
+ ' ::\n'
+ '\n'
+ ' bzr Demo something\n'
'\n')
def test_concise_help_text(self):
More information about the bazaar-commits
mailing list