blob: 69d4e6e002af666ba276e733db375d0e2c43512f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/usr/bin/perl -pi
# Too many \color directives (generated by DIFdel/addbegin/end)
# confuse xetex, producing errors:
# WARNING ** Color stack overflow. Just ignore.
# and resulting in corrupted color in output.
# As a work-around, detect cases where it's safe, and replace \color with
# \textcolor.
# As a result, number of \color directives goes does sufficiently
# enough to avoid the overflow error.
s/\\DIFdelbegin \\DIFdel{([^}]*)}\\DIFdelend/\\DIFdeltext{$1}/;
s/\\DIFaddbegin \\DIFadd{([^}]*)}\\DIFaddend/\\DIFaddtext{$1}/;
# external \color does not seem to apply to footnotes.
# detect and replace with \textcolor within footnotes
s/(\\footnote\s*{[^}]*)\\DIFadd{/$1\\DIFaddtext{$2/;
s/(\\footnote\s*{[^}]*)\\DIFdel{/$1\\DIFdeltext{$2/;
|