|
@@ -16,36 +16,41 @@ def view_diff_data_2(conn, name):
|
|
|
curs.execute(db_change("select data from history where id = ? and title = ?"), [first, name])
|
|
curs.execute(db_change("select data from history where id = ? and title = ?"), [first, name])
|
|
|
first_raw_data = curs.fetchall()
|
|
first_raw_data = curs.fetchall()
|
|
|
if first_raw_data:
|
|
if first_raw_data:
|
|
|
|
|
+ first_raw_data = first_raw_data[0][0].replace('\r', '')
|
|
|
|
|
+
|
|
|
curs.execute(db_change("select data from history where id = ? and title = ?"), [second, name])
|
|
curs.execute(db_change("select data from history where id = ? and title = ?"), [second, name])
|
|
|
second_raw_data = curs.fetchall()
|
|
second_raw_data = curs.fetchall()
|
|
|
if second_raw_data:
|
|
if second_raw_data:
|
|
|
|
|
+ second_raw_data = second_raw_data[0][0].replace('\r', '')
|
|
|
|
|
+
|
|
|
if first == second:
|
|
if first == second:
|
|
|
result = ''
|
|
result = ''
|
|
|
elif first_raw_data == second_raw_data:
|
|
elif first_raw_data == second_raw_data:
|
|
|
result = ''
|
|
result = ''
|
|
|
else:
|
|
else:
|
|
|
- i = 2
|
|
|
|
|
|
|
+ i = 1
|
|
|
include_ins = 0
|
|
include_ins = 0
|
|
|
- diff_data = '1 : ' + diff_match_patch().diff_prettyHtml(diff_match_patch().diff_main(first_raw_data[0][0], second_raw_data[0][0]))
|
|
|
|
|
|
|
+ diff_data = diff_match_patch().diff_prettyHtml(diff_match_patch().diff_main(first_raw_data, second_raw_data))
|
|
|
|
|
+ end_data = ''
|
|
|
|
|
|
|
|
- re_data = re.findall('((?:(?!¶<br>).)*)(?:¶<br>|$)', diff_data)
|
|
|
|
|
|
|
+ re_data = re.findall('(?:(?:(?:(?!¶<br>).)*)(?:¶<br>)|(?:(?:(?!¶<br>).)+)$)', diff_data)
|
|
|
for re_in_data in re_data:
|
|
for re_in_data in re_data:
|
|
|
|
|
+ re_in_data = re.sub('¶<br>$', '', re_in_data)
|
|
|
if re.search('(<ins |<del )', re_in_data) and re.search('(<\/ins>|<\/del>)', re_in_data):
|
|
if re.search('(<ins |<del )', re_in_data) and re.search('(<\/ins>|<\/del>)', re_in_data):
|
|
|
- re_data[i - 2] = str(i) + ' : ' + re_data[i - 2] + '\n'
|
|
|
|
|
|
|
+ end_data += str(i) + ' : ' + re_in_data + '\n'
|
|
|
include_ins = 0
|
|
include_ins = 0
|
|
|
elif re.search('(<\/ins>|<\/del>)', re_in_data):
|
|
elif re.search('(<\/ins>|<\/del>)', re_in_data):
|
|
|
- re_data[i - 2] = str(i) + ' : ' + re_data[i - 2] + '\n'
|
|
|
|
|
|
|
+ end_data += str(i) + ' : ' + re_in_data + '\n'
|
|
|
include_ins = 0
|
|
include_ins = 0
|
|
|
elif re.search('(<ins |<del )', re_in_data) or include_ins == 1:
|
|
elif re.search('(<ins |<del )', re_in_data) or include_ins == 1:
|
|
|
- re_data[i - 2] = str(i) + ' : ' + re_data[i - 2] + '\n'
|
|
|
|
|
|
|
+ end_data += str(i) + ' : ' + re_in_data + '\n'
|
|
|
include_ins = 1
|
|
include_ins = 1
|
|
|
else:
|
|
else:
|
|
|
- re_data[i - 2] = ''
|
|
|
|
|
include_ins = 0
|
|
include_ins = 0
|
|
|
|
|
|
|
|
i += 1
|
|
i += 1
|
|
|
|
|
|
|
|
- result = '<pre>' + ''.join(re_data) + '</pre>'
|
|
|
|
|
|
|
+ result = '<pre>' + end_data + '</pre>'
|
|
|
|
|
|
|
|
return easy_minify(flask.render_template(skin_check(),
|
|
return easy_minify(flask.render_template(skin_check(),
|
|
|
imp = [name, wiki_set(), custom(), other2([' (' + load_lang('compare') + ')', 0])],
|
|
imp = [name, wiki_set(), custom(), other2([' (' + load_lang('compare') + ')', 0])],
|