mercurial/templatefilters.py
changeset 21820 cce404b0c918
parent 19886 e828975722c8
child 21873 cf599f8a2da8
--- a/mercurial/templatefilters.py	Thu May 01 19:57:25 2014 +0900
+++ b/mercurial/templatefilters.py	Thu Jun 12 17:45:41 2014 -0700
@@ -8,6 +8,7 @@
 import cgi, re, os, time, urllib
 import encoding, node, util
 import hbisect
+import templatekw
 
 def addbreaks(text):
     """:addbreaks: Any text. Add an XHTML "<br />" tag before the end of
@@ -302,6 +303,10 @@
     """:shortdate: Date. Returns a date like "2006-09-18"."""
     return util.shortdate(text)
 
+def splitlines(text):
+    """:splitlines: Any text. Split text into a list of lines."""
+    return templatekw.showlist('line', text.splitlines(), 'lines')
+
 def stringescape(text):
     return text.encode('string_escape')
 
@@ -384,6 +389,7 @@
     "short": short,
     "shortbisect": shortbisect,
     "shortdate": shortdate,
+    "splitlines": splitlines,
     "stringescape": stringescape,
     "stringify": stringify,
     "strip": strip,