diff MoinMoin/wikiutil.py @ 156:206b3db4eade

RC: make NEW icon clickable, make long comment parts breakable (fixing ugly rendering for some use cases) imported from: moin--main--1.5--patch-158
author Thomas Waldmann <tw@waldmann-edv.de>
date Sat, 29 Oct 2005 20:18:48 +0000
parents 88acc9c18b90
children 99bf20eeb0bc
line wrap: on
line diff
--- a/MoinMoin/wikiutil.py	Sat Oct 29 19:10:31 2005 +0000
+++ b/MoinMoin/wikiutil.py	Sat Oct 29 20:18:48 2005 +0000
@@ -237,6 +237,19 @@
         s = s.replace('"', "&quot;")
     return s
 
+def make_breakable(text, maxlen):
+    """ make a text breakable by inserting spaces into nonbreakable parts
+    """
+    text = text.split(" ")
+    newtext = []
+    for part in text:
+        if len(part) > maxlen:
+            while part:
+                newtext.append(part[:maxlen])
+                part = part[maxlen:]
+        else:
+            newtext.append(part)
+    return " ".join(newtext)
 
 ########################################################################
 ### Storage