Mercurial > public > mercurial-scm > hg-stable
diff mercurial/minirst.py @ 15262:e8076af14498
minirst: add style flag to format
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sat, 15 Oct 2011 00:39:04 -0500 |
parents | e2df5b866d22 |
children | 87bb6b7644f6 |
line wrap: on
line diff
--- a/mercurial/minirst.py Sat Oct 15 00:39:01 2011 -0500 +++ b/mercurial/minirst.py Sat Oct 15 00:39:04 2011 -0500 @@ -608,10 +608,13 @@ text = ''.join(formatblock(b, width) for b in blocks) return text -def format(text, width, indent=0, keep=None): +def format(text, width=80, indent=0, keep=None, style='plain'): """Parse and format the text according to width.""" blocks, pruned = parse(text, indent, keep or []) - text = ''.join(formatblock(b, width) for b in blocks) + if style == 'html': + text = formathtml(blocks) + else: + text = ''.join(formatblock(b, width) for b in blocks) if keep is None: return text else: