diff --git a/mercurial/minirst.py b/mercurial/minirst.py --- a/mercurial/minirst.py +++ b/mercurial/minirst.py @@ -452,7 +452,7 @@ def findadmonitions(blocks, admonitions= } def formatoption(block, width): - desc = ' '.join(map(str.strip, block['lines'])) + desc = ' '.join(map(bytes.strip, block['lines'])) colwidth = encoding.colwidth(block['optstr']) usablewidth = width - 1 hanging = block['optstrwidth'] @@ -474,7 +474,7 @@ def formatblock(block, width): hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip()) defindent = indent + hang * ' ' - text = ' '.join(map(str.strip, block['lines'])) + text = ' '.join(map(bytes.strip, block['lines'])) return '%s\n%s\n' % (indent + admonition, util.wrap(text, width=width, initindent=defindent, @@ -512,7 +512,7 @@ def formatblock(block, width): term = indent + block['lines'][0] hang = len(block['lines'][-1]) - len(block['lines'][-1].lstrip()) defindent = indent + hang * ' ' - text = ' '.join(map(str.strip, block['lines'][1:])) + text = ' '.join(map(bytes.strip, block['lines'][1:])) return '%s\n%s\n' % (term, util.wrap(text, width=width, initindent=defindent, hangindent=defindent)) @@ -567,7 +567,7 @@ def formathtml(blocks): if btype == 'admonition': admonition = escape(_admonitiontitles[b['admonitiontitle']]) - text = escape(' '.join(map(str.strip, lines))) + text = escape(' '.join(map(bytes.strip, lines))) out.append('

\n%s %s\n

\n' % (admonition, text)) elif btype == 'paragraph': out.append('

\n%s\n

\n' % escape('\n'.join(lines))) @@ -597,7 +597,7 @@ def formathtml(blocks): elif btype == 'definition': openlist('dl', level) term = escape(lines[0]) - text = escape(' '.join(map(str.strip, lines[1:]))) + text = escape(' '.join(map(bytes.strip, lines[1:]))) out.append('
%s\n
%s\n' % (term, text)) elif btype == 'bullet': bullet, head = lines[0].split(' ', 1) @@ -609,12 +609,12 @@ def formathtml(blocks): elif btype == 'field': openlist('dl', level) key = escape(b['key']) - text = escape(' '.join(map(str.strip, lines))) + text = escape(' '.join(map(bytes.strip, lines))) out.append('
%s\n
%s\n' % (key, text)) elif btype == 'option': openlist('dl', level) opt = escape(b['optstr']) - desc = escape(' '.join(map(str.strip, lines))) + desc = escape(' '.join(map(bytes.strip, lines))) out.append('
%s\n
%s\n' % (opt, desc)) # close lists if indent level of next block is lower