Improve comment handling of diff tool

This commit is contained in:
jaseg 2021-07-13 13:56:46 +02:00
parent f14b83d064
commit 61f4b840bc
2 changed files with 5 additions and 4 deletions

View file

@ -22,8 +22,8 @@ def generate_git_tex_diff(texfile, bibliography, revision):
bib_proc = subprocess.run(['git', 'diff', f'-U{bib_lines+1}', '--word-diff', '--color=always', revision, bibliography],
check=True, capture_output=True)
addition_re = re.compile('\033\\[32m\\{\\+(.*?)\\+\\}\033\\[m')
deletion_re = re.compile('\033\\[31m\\[-(.*?)\\-]\033\\[m')
addition_re = re.compile('\033\\[32m\\{\\+(.*?)([^\\\\]%.*?)?\\+\\}\033\\[m')
deletion_re = re.compile('\033\\[31m\\[-(.*?)([^\\\\]%.*?)?\\-]\033\\[m')
csi_re = re.compile('\033\\[.*?m')
bibtex_entry_def_re = re.compile('@.*?{(.*?),')