Show More
@@ -268,10 +268,7 b' def fill76(text):' | |||
|
268 | 268 | @templatefilter(b'firstline', intype=bytes) |
|
269 | 269 | def firstline(text): |
|
270 | 270 | """Any text. Returns the first line of text.""" |
|
271 | try: | |
|
272 | return text.splitlines()[0] | |
|
273 | except IndexError: | |
|
274 | return b'' | |
|
271 | return stringutil.firstline(text) | |
|
275 | 272 | |
|
276 | 273 | |
|
277 | 274 | @templatefilter(b'hex', intype=bytes) |
@@ -685,6 +685,14 b' def isauthorwellformed(author):' | |||
|
685 | 685 | return _correctauthorformat.match(author) is not None |
|
686 | 686 | |
|
687 | 687 | |
|
688 | def firstline(text): | |
|
689 | """Return the first line of the input""" | |
|
690 | try: | |
|
691 | return text.splitlines()[0] | |
|
692 | except IndexError: | |
|
693 | return b'' | |
|
694 | ||
|
695 | ||
|
688 | 696 | def ellipsis(text, maxlength=400): |
|
689 | 697 | """Trim string to at most maxlength (default: 400) columns in display.""" |
|
690 | 698 | return encoding.trim(text, maxlength, ellipsis=b'...') |
General Comments 0
You need to be logged in to leave comments.
Login now