diff options
author | jaseg <git@jaseg.de> | 2021-09-29 14:15:51 +0200 |
---|---|---|
committer | jaseg <git@jaseg.de> | 2021-09-29 14:15:51 +0200 |
commit | 9c10f393bc3d33179e070950ac00ec231f8a6847 (patch) | |
tree | 27d5fb519f6a22e93bfb105755ee6c63f0347266 /paper | |
parent | a16f032fa7a42d5fa56f5ee71c15634f8b9e9949 (diff) | |
download | ihsm-9c10f393bc3d33179e070950ac00ec231f8a6847.tar.gz ihsm-9c10f393bc3d33179e070950ac00ec231f8a6847.tar.bz2 ihsm-9c10f393bc3d33179e070950ac00ec231f8a6847.zip |
Fixed small changes diff
Diffstat (limited to 'paper')
-rw-r--r-- | paper/diffinator.py | 21 |
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 |