1
0
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:
lins05
2012-10-20 11:48:19 +08:00
parent 4bb5cb2582
commit 5545afe6d7
5 changed files with 49 additions and 31 deletions

View File

@@ -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','&nbsp;')
return data_rows
# return data_rows.replace('\0+',''). \
# replace('\0-',''). \
# replace('\0^',''). \
# replace('\1',''). \
# replace('\t','&nbsp;')
del re