# HG changeset patch # User Olav Reinert # Date 1338544703 -7200 # Node ID e740746ea557f8855f9fb6604dd70486c1a10ad0 # Parent d3b807e673a84326be044f394ad85aea99daa22e minirst: generate tables as a list of joined lines diff -r d3b807e673a8 -r e740746ea557 mercurial/commands.py --- a/mercurial/commands.py Sat May 26 20:49:51 2012 +0200 +++ b/mercurial/commands.py Fri Jun 01 11:58:23 2012 +0200 @@ -3324,7 +3324,8 @@ ('extensioncommands', _('Extension Commands'))): if matches[t]: ui.write('%s:\n\n' % title) - ui.write(minirst.format(minirst.maketable(matches[t], 1))) + rst = ''.join(minirst.maketable(matches[t], 1)) + ui.write(minirst.format(rst)) return if name and name != 'shortlist': diff -r d3b807e673a8 -r e740746ea557 mercurial/help.py --- a/mercurial/help.py Sat May 26 20:49:51 2012 +0200 +++ b/mercurial/help.py Fri Jun 01 11:58:23 2012 +0200 @@ -58,9 +58,9 @@ rst = minirst.maketable(data, 1) if multioccur: - rst += _("\n[+] marked option can be specified multiple times\n") + rst.append(_("\n[+] marked option can be specified multiple times\n")) - return rst + return ''.join(rst) # list all option lists def opttext(optlist, width, verbose): diff -r d3b807e673a8 -r e740746ea557 mercurial/minirst.py --- a/mercurial/minirst.py Sat May 26 20:49:51 2012 +0200 +++ b/mercurial/minirst.py Fri Jun 01 11:58:23 2012 +0200 @@ -658,7 +658,7 @@ return lines def maketable(data, indent=0, header=False): - '''Generate an RST table for the given table data''' + '''Generate an RST table for the given table data as a list of lines''' widths = [max(encoding.colwidth(e) for e in c) for c in zip(*data)] indent = ' ' * indent @@ -674,4 +674,4 @@ if header and len(data) > 1: out.insert(2, div) out.append(div) - return ''.join(out) + return out diff -r d3b807e673a8 -r e740746ea557 tests/test-minirst.py --- a/tests/test-minirst.py Sat May 26 20:49:51 2012 +0200 +++ b/tests/test-minirst.py Fri Jun 01 11:58:23 2012 +0200 @@ -237,7 +237,8 @@ ['1', '2', '3'], ['foo', 'bar', 'baz this list is very very very long man']] -table = minirst.maketable(data, 2, True) +rst = minirst.maketable(data, 2, True) +table = ''.join(rst) print table