Project

General

Profile

« Previous | Next » 

Revision 12749

bugfix: bin/repl: text mode: also don't match if it's a word in a sentence

View differences:

repl
16 16

  
17 17
quote_re = '[\'"`]'
18 18
excluded_prefix_re = (
19
	'(?<!\*)' # don't double leading *
20
	)
19
     '(?<! )' # not if it's a word in a sentence
20
    +'(?<!\*)' # don't double leading *
21
    )
22
excluded_suffix_re = (
23
     '(?! )' # not if it's a word in a sentence
24
    )
21 25

  
22 26
def unescape_html(str_): return HTMLParser.HTMLParser().unescape(str_)
23 27

  
......
55 59
                    # don't try to match word w/ suffix, because there are cases
56 60
                    # where a mapping adds a suffix which would cause the same
57 61
                    # replacement to be performed repeatedly
58
                    in_word_re = excluded_prefix_re+r'\b'+in_str_re+r'\b'
62
                    in_word_re = (excluded_prefix_re+r'\b'+in_str_re+r'\b'
63
                        +excluded_suffix_re)
59 64
                    in_ = '(?:'+in_+'|'+in_word_re+')'
60 65
            repls.append((r'(?m)'+in_, out))
61 66
    stream.close()

Also available in: Unified diff