# HG changeset patch # User Jeff Hammel # Date 1399915746 25200 # Node ID 8cf9a26b9aaaece7443fa240bf3c9fed26dbc626 # Parent 55e0579e2143186ef5cb533822c1346d4125d96e STUB: textshaper/main.py textshaper/tablify.py diff -r 55e0579e2143 -r 8cf9a26b9aaa textshaper/main.py --- a/textshaper/main.py Sat May 03 14:47:16 2014 -0700 +++ b/textshaper/main.py Mon May 12 10:29:06 2014 -0700 @@ -12,6 +12,7 @@ import time from .commands import Commands from .indent import deindent, indent +from .tablify import make_csv from .whitespace import underscore from which import which @@ -41,6 +42,7 @@ commands.add(indent, 'i') commands.add(deindent, 'd') commands.add(underscore, 'u') + commands.add(make_csv, 'c') return commands diff -r 55e0579e2143 -r 8cf9a26b9aaa textshaper/tablify.py --- a/textshaper/tablify.py Sat May 03 14:47:16 2014 -0700 +++ b/textshaper/tablify.py Mon May 12 10:29:06 2014 -0700 @@ -1,3 +1,16 @@ +""" +functions having to do with tables +""" + +import csv +from .decorator import lines +from StringIO import StringIO + +@lines +def make_csv(text): + """make space-separated text into comma-separated""" + return [','.join(line.strip().split()) for line in text] + def format_cols(rows, header=None, right_align=()): if header: raise NotImplementedError('TODO') # -> record TODO items