From b665b3165b454b98c782617e37a128b53b56c89c Mon Sep 17 00:00:00 2001 From: mstsirkin Date: Thu, 26 Jun 2014 12:34:38 +0000 Subject: work around xetex bug Too many \color directives produce corrupted output and this warning: WARNING ** Color stack overflow. Just ignore. Use script to reduce # of these directives. Signed-off-by: Michael S. Tsirkin git-svn-id: https://tools.oasis-open.org/version-control/svn/virtio@389 0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652 --- fixupdiff.pl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 fixupdiff.pl (limited to 'fixupdiff.pl') diff --git a/fixupdiff.pl b/fixupdiff.pl new file mode 100755 index 0000000..69d4e6e --- /dev/null +++ b/fixupdiff.pl @@ -0,0 +1,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/; -- cgit