mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-26 07:22:34 +00:00
improve diff related code
This commit is contained in:
@@ -1875,17 +1875,21 @@ class HtmlDiff(object):
|
||||
|
||||
cls = ''
|
||||
if '\0+' in text:
|
||||
cls = 'diff_add'
|
||||
cls = 'diff-add'
|
||||
elif '\0-' in text:
|
||||
cls = 'diff_sub'
|
||||
cls = 'diff-sub'
|
||||
elif '\0^' in text:
|
||||
cls = 'diff_chg'
|
||||
cls = 'diff-chg'
|
||||
|
||||
text = text.replace('\0+', '').replace('\0-', ''). \
|
||||
replace('\0^', '').replace('\1', ''). \
|
||||
replace('\t',' ')
|
||||
|
||||
if cls:
|
||||
return '<td class="diff_header">%s</td><td class=%s>%s</td>' \
|
||||
return '<td class="diff-header">%s</td><td class=%s>%s</td>' \
|
||||
% (linenum,cls,text)
|
||||
else:
|
||||
return '<td class="diff_header">%s</td><td>%s</td>' \
|
||||
return '<td class="diff-header">%s</td><td>%s</td>' \
|
||||
% (linenum,text)
|
||||
|
||||
def _make_prefix(self):
|
||||
@@ -2004,11 +2008,13 @@ class HtmlDiff(object):
|
||||
|
||||
data_rows = ''.join(s)
|
||||
|
||||
return data_rows.replace('\0+',''). \
|
||||
replace('\0-',''). \
|
||||
replace('\0^',''). \
|
||||
replace('\1',''). \
|
||||
replace('\t',' ')
|
||||
return data_rows
|
||||
|
||||
# return data_rows.replace('\0+',''). \
|
||||
# replace('\0-',''). \
|
||||
# replace('\0^',''). \
|
||||
# replace('\1',''). \
|
||||
# replace('\t',' ')
|
||||
|
||||
del re
|
||||
|
||||
|
Reference in New Issue
Block a user