summaryrefslogtreecommitdiff
path: root/paper
diff options
context:
space:
mode:
Diffstat (limited to 'paper')
-rw-r--r--paper/diffinator.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/paper/diffinator.py b/paper/diffinator.py
index 53f9439..aa1e969 100644
--- a/paper/diffinator.py
+++ b/paper/diffinator.py
@@ -76,24 +76,28 @@ def generate_git_tex_diff(texfile, bibliography, revision):
if debug:
print(f'old={repr(old)}, new={repr(new)}', file=sys.stderr)
- if len(old) < 12 and len(new) < 12:
- return new
+ #if len(old) < 5 and len(new) < 5:
+ # return new
- if old.count(' ') < 3 and new.count(' ') < 3:
- return new
+ #if old.count(' ') < 2 and new.count(' ') < 2:
+ # return new
- if '}' in old or '{' in old or '{' in new or '}' in new:
+ if old.count('{') != old.count('}') or new.count('{') != new.count('}'):
return new
new_chars = list(new)
+ hits = 0
for char in old:
if char not in string.ascii_letters:
continue
if char not in new_chars:
- return r' \color{diffred}' + old + r' \color{diffgreen}' + new + ' \color{black}'
+ hits += 1
+ if hits >= 3:
+ return r' \color{diffred}' + old + r' \color{diffgreen}' + new + ' \color{black}'
- new_chars.remove(char)
+ else:
+ new_chars.remove(char)
if any(char in string.ascii_letters for char in new_chars):
return r' \color{diffred}' + old + r' \color{diffgreen}' + new + ' \color{black}'
@@ -108,7 +112,8 @@ def generate_git_tex_diff(texfile, bibliography, revision):
change = match.group(1)
change, _, _rest = change.partition('%')
- if len(change) < 12 or change.count(' ') < 3 or '}' in change or '{' in change:
+ #if len(change) <= 3 or change.count(' ') < 2 or change.count('{') != change.count('}'):
+ if change.count('{') != change.count('}'):
if action == 'addition':
return change
else: # deletion