##// END OF EJS Templates
minirst: extract function that formats parsed blocks as plain text
Yuya Nishihara -
r39343:92e9aa38 default
parent child Browse files
Show More
@@ -663,6 +663,10 b' def formatblocks(blocks, width):'
663 text = ''.join(formatblock(b, width) for b in blocks)
663 text = ''.join(formatblock(b, width) for b in blocks)
664 return text
664 return text
665
665
666 def formatplain(blocks, width):
667 """Format parsed blocks as plain text"""
668 return ''.join(formatblock(b, width) for b in blocks)
669
666 def format(text, width=80, indent=0, keep=None, style='plain', section=None):
670 def format(text, width=80, indent=0, keep=None, style='plain', section=None):
667 """Parse and format the text according to width."""
671 """Parse and format the text according to width."""
668 blocks, pruned = parse(text, indent, keep or [])
672 blocks, pruned = parse(text, indent, keep or [])
@@ -671,7 +675,7 b' def format(text, width=80, indent=0, kee'
671 if style == 'html':
675 if style == 'html':
672 text = formathtml(blocks)
676 text = formathtml(blocks)
673 else:
677 else:
674 text = ''.join(formatblock(b, width) for b in blocks)
678 text = formatplain(blocks, width=width)
675 if keep is None:
679 if keep is None:
676 return text
680 return text
677 else:
681 else:
General Comments 0
You need to be logged in to leave comments. Login now