mercurial/minirst.py
changeset 39310 a2a5d4ad5276
parent 39307 92e9aa38a578
child 39311 57f9b3d91abc
equal deleted inserted replaced
39309:0a766cb1092a 39310:a2a5d4ad5276
   671     """Parse and format the text according to width."""
   671     """Parse and format the text according to width."""
   672     blocks, pruned = parse(text, indent, keep or [])
   672     blocks, pruned = parse(text, indent, keep or [])
   673     if section:
   673     if section:
   674         blocks = filtersections(blocks, section)
   674         blocks = filtersections(blocks, section)
   675     if style == 'html':
   675     if style == 'html':
   676         text = formathtml(blocks)
   676         return formathtml(blocks)
   677     else:
   677     else:
   678         text = formatplain(blocks, width=width)
   678         return formatplain(blocks, width=width)
   679     if keep is None:
       
   680         return text
       
   681     else:
       
   682         return text, pruned
       
   683 
   679 
   684 def filtersections(blocks, section):
   680 def filtersections(blocks, section):
   685     """Select parsed blocks under the specified section"""
   681     """Select parsed blocks under the specified section"""
   686     parents = []
   682     parents = []
   687     sections = getsections(blocks)
   683     sections = getsections(blocks)