From 1fa202c5c2c683de6be893cd03986887c8771951 Mon Sep 17 00:00:00 2001 From: helmutm Date: Mon, 16 Feb 2009 10:10:50 +0000 Subject: [PATCH] provide description appropriately formatted for title attribute and info field git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3239 fd906abe-77d9-0310-91a1-e0d9ade77398 --- util/format.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/util/format.py b/util/format.py index a5b532e..da20356 100644 --- a/util/format.py +++ b/util/format.py @@ -27,12 +27,21 @@ from datetime import datetime def nl2br(text): - if not text: return text + if not text: + return text if '\n' in text: # Unix or DOS line endings return '
\n'.join(x.replace('\r', '') for x in text.split('\n')) else: # gracefully handle Mac line endigns return '
\n'.join(text.split('\r')) +def nl2pipe(text): + if not text: + return text + if '\n' in text: # Unix or DOS line endings + return ' | '.join(x.replace('\r', '') for x in text.split('\n')) + else: + return ' | '.join(text.split('\r')) + def formatDate(dt=None, type='date', variant='medium', lang='de'): """ type: date, time, dateTime;