mercurial/templater.py
changeset 3636 bf3dec184c78
parent 3635 231393b7316f
child 3637 6a46c9ccc2ed
equal deleted inserted replaced
3635:231393b7316f 3636:bf3dec184c78
   202                 yield text[start:w], text[w:]
   202                 yield text[start:w], text[w:]
   203                 break
   203                 break
   204             yield text[start:m.start(0)], m.group(1)
   204             yield text[start:m.start(0)], m.group(1)
   205             start = m.end(1)
   205             start = m.end(1)
   206 
   206 
   207     fp = cStringIO.StringIO()
   207     return "".join([space_re.sub(' ', textwrap.fill(para, width)) + rest
   208     for para, rest in findparas():
   208                     for para, rest in findparas()])
   209         fp.write(space_re.sub(' ', textwrap.fill(para, width)))
       
   210         fp.write(rest)
       
   211     return fp.getvalue()
       
   212 
   209 
   213 def firstline(text):
   210 def firstline(text):
   214     '''return the first line of text'''
   211     '''return the first line of text'''
   215     try:
   212     try:
   216         return text.splitlines(1)[0].rstrip('\r\n')
   213         return text.splitlines(1)[0].rstrip('\r\n')