##// END OF EJS Templates
fixes issue #678 Incorrect diff markup when diff contains >, <, or & symbols...
marcink -
r3085:7d0476e1 beta
parent child Browse files
Show More
@@ -193,6 +193,9 b' class DiffProcessor(object):'
193 (?:^\+\+\+[ ](b/(?P<b_file>.+)|/dev/null)(?:\n|$))?
193 (?:^\+\+\+[ ](b/(?P<b_file>.+)|/dev/null)(?:\n|$))?
194 """, re.VERBOSE | re.MULTILINE)
194 """, re.VERBOSE | re.MULTILINE)
195
195
196 #used for inline highlighter word split
197 _token_re = re.compile(r'()(&gt;|&lt;|&amp;|\W+?)')
198
196 def __init__(self, diff, vcs='hg', format='gitdiff', diff_limit=None):
199 def __init__(self, diff, vcs='hg', format='gitdiff', diff_limit=None):
197 """
200 """
198 :param diff: a text in diff format
201 :param diff: a text in diff format
@@ -274,9 +277,8 b' class DiffProcessor(object):'
274 else:
277 else:
275 old, new = next_, line
278 old, new = next_, line
276
279
277 oldwords = re.split(r'(\W)', old['line'])
280 oldwords = self._token_re.split(old['line'])
278 newwords = re.split(r'(\W)', new['line'])
281 newwords = self._token_re.split(new['line'])
279
280 sequence = difflib.SequenceMatcher(None, oldwords, newwords)
282 sequence = difflib.SequenceMatcher(None, oldwords, newwords)
281
283
282 oldfragments, newfragments = [], []
284 oldfragments, newfragments = [], []
General Comments 0
You need to be logged in to leave comments. Login now