mercurial/minirst.py
changeset 34131 0fa781320203
parent 32526 9d08283946f0
child 34695 e178fcaa3933
equal deleted inserted replaced
34130:ada8a19672ab 34131:0fa781320203
    44 
    44 
    45 def replace(text, substs):
    45 def replace(text, substs):
    46     '''
    46     '''
    47     Apply a list of (find, replace) pairs to a text.
    47     Apply a list of (find, replace) pairs to a text.
    48 
    48 
    49     >>> replace("foo bar", [('f', 'F'), ('b', 'B')])
    49     >>> replace(b"foo bar", [(b'f', b'F'), (b'b', b'B')])
    50     'Foo Bar'
    50     'Foo Bar'
    51     >>> encoding.encoding = 'latin1'
    51     >>> encoding.encoding = b'latin1'
    52     >>> replace('\\x81\\\\', [('\\\\', '/')])
    52     >>> replace(b'\\x81\\\\', [(b'\\\\', b'/')])
    53     '\\x81/'
    53     '\\x81/'
    54     >>> encoding.encoding = 'shiftjis'
    54     >>> encoding.encoding = b'shiftjis'
    55     >>> replace('\\x81\\\\', [('\\\\', '/')])
    55     >>> replace(b'\\x81\\\\', [(b'\\\\', b'/')])
    56     '\\x81\\\\'
    56     '\\x81\\\\'
    57     '''
    57     '''
    58 
    58 
    59     # some character encodings (cp932 for Japanese, at least) use
    59     # some character encodings (cp932 for Japanese, at least) use
    60     # ASCII characters other than control/alphabet/digit as a part of
    60     # ASCII characters other than control/alphabet/digit as a part of