X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=support%2Ftext_prettify.py;h=751df38aeb661bd9aab907219a1545d53936e676;hb=1350633e419f802975c773db8de86e3de49ea7fd;hp=60963f8ce712a6940ecf53d0314c620d04cd7a6c;hpb=df271527a6e3e4d10da9f9be3d1e9ebea9171493;p=cipher-tools.git diff --git a/support/text_prettify.py b/support/text_prettify.py index 60963f8..751df38 100644 --- a/support/text_prettify.py +++ b/support/text_prettify.py @@ -1,6 +1,12 @@ import string from support.segment import segment -from support.utilities import cat, sanitise +from support.utilities import cat, lcat, sanitise + + +def prettify(text, width=100): + """Segment a text into words, then pack into lines, and combine the lines + into a single string for printing.""" + return lcat(tpack(segment(text), width=width)) def tpack(text, width=100):