diff options
author | mstsirkin <mstsirkin@0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652> | 2014-06-26 12:35:01 +0000 |
---|---|---|
committer | mstsirkin <mstsirkin@0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652> | 2014-06-26 12:35:01 +0000 |
commit | fc27ea190b89ed5a654f9ccc326caff2558dc56f (patch) | |
tree | abcd26b1763bde7ac107fd234c7bc89cb555be54 | |
parent | b614cfed56a9f63c4247f33c36a29ad47a9a6c19 (diff) |
more latexdiff hacks
- change link color from green to pinegreen. Looks better to me.
- split footnotes out from their text, so that latexdiff
does not consider them as a unit
- mark field command as safe for latexdiff, otherwise it's not shown in red
- hack adding DIFaddtext within footnotes could not handle
case where latexdiff inserted multiple DIFadd within the
footnote. Instead, detect when footnote is within
DIFaddbegin/DIFdelbegin, add an extra DIFaddbegin/DIFdelbegin
within the footnote.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
git-svn-id: https://tools.oasis-open.org/version-control/svn/virtio@391 0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652
-rw-r--r-- | diffpreamble.tex | 6 | ||||
-rwxr-xr-x | fixupdiff.pl | 25 | ||||
-rwxr-xr-x | makediffpdf.sh | 13 |
3 files changed, 36 insertions, 8 deletions
diff --git a/diffpreamble.tex b/diffpreamble.tex index 35ae830..6242878 100644 --- a/diffpreamble.tex +++ b/diffpreamble.tex @@ -1,5 +1,7 @@ %% diffpreable.tex start +\definecolor{pinegreen}{rgb}{0.0, 0.47, 0.44} + %DIF FONTSTRIKE PREAMBLE \RequirePackage[normalem]{ulem} \providecommand{\DIFadd}[1]{{\sf #1}} @@ -9,9 +11,9 @@ %DIF COLOR PREAMBLE \RequirePackage{color} \providecommand{\DIFaddbegin}{\protect\color{blue}\hypersetup{linkcolor=blue,urlcolor=blue}} -\providecommand{\DIFaddend}{\protect\color{black}\hypersetup{linkcolor=green,urlcolor=green}} +\providecommand{\DIFaddend}{\protect\color{black}\hypersetup{linkcolor=pinegreen,urlcolor=pinegreen}} \providecommand{\DIFdelbegin}{\protect\color{red}\hypersetup{linkcolor=red,urlcolor=red}} -\providecommand{\DIFdelend}{\protect\color{black}\hypersetup{linkcolor=green,urlcolor=green}} +\providecommand{\DIFdelend}{\protect\color{black}\hypersetup{linkcolor=pinegreen,urlcolor=pinegreen}} %DIF END COLOR PREAMBLE \providecommand{\DIFaddtext}[1]{\textcolor{blue}{\sf #1}} \providecommand{\DIFdeltext}[1]{\textcolor{red}{\footnotesize \sout{#1}}} diff --git a/fixupdiff.pl b/fixupdiff.pl index 69d4e6e..ce30692 100755 --- a/fixupdiff.pl +++ b/fixupdiff.pl @@ -13,6 +13,25 @@ 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/; +# detect and replace with \color within footnotes + +if (m/\\DIFaddbegin/) { + $diffadd=1; +} +if (m/\\DIFaddend/) { + $diffadd=0; +} +if (m/\\DIFdelbegin/) { + $diffdel=1; +} +if (m/\\DIFdelend/) { + $diffdel=0; +} + +if ($diffadd) { +s/(\\footnote\s*{)/$1\\DIFaddbegin{}/; +} + +if ($diffdel) { +s/(\\footnote\s*{)/$1\\DIFdelbegin{}/; +} diff --git a/makediffpdf.sh b/makediffpdf.sh index 34904bf..cb84d07 100755 --- a/makediffpdf.sh +++ b/makediffpdf.sh @@ -9,7 +9,7 @@ cd "${cur}/old" git checkout ec1ffbf27a8f0a06ca65cd498a69c7f89bd97dc1 mv specvars.tex specvars-orig.tex #make links green to avoid confusion -sed s/blue/green/ specvars-orig.tex > specvars.tex +sed s/blue/pinegreen/ specvars-orig.tex > specvars.tex SPECDOC=${SPECDOC:-`cat REVISION`} ./make-setup-generated.sh "$SPECDOC" #wget http://www.ctan.org/pkg/latexpand @@ -20,14 +20,21 @@ git clone $PWD new cd "${cur}/new" mv specvars.tex specvars-orig.tex #make links green to avoid confusion -sed s/blue/green/ specvars-orig.tex > specvars.tex +sed s/blue/pinegreen/ specvars-orig.tex > specvars.tex SPECDOC=${SPECDOC:-`cat REVISION`} ./make-setup-generated.sh "$SPECDOC" latexpand virtio.tex -o flat.tex cd "${cur}" +# latexdiff does not do diffs within footnotes +# adding space make it not realize the text is a footnote, +# and treat it normally +sed 's/\\footnote{/\\footnote {/' old/flat.tex > old/flat-fixed.tex +sed 's/\\footnote{/\\footnote {/' new/flat.tex > new/flat-fixed.tex +#cp old/flat.tex old/flat-fixed.tex +#cp new/flat.tex new/flat-fixed.tex #wget http://mirror.math.ku.edu/tex-archive/support/latexdiff/latexdiff-fast #chmod +x latexdiff-fast -latexdiff-fast -p diffpreamble.tex old/flat.tex new/flat.tex > virtio-diff.tex +latexdiff-fast --append-safecmd=field --ignore-warnings -p diffpreamble.tex old/flat-fixed.tex new/flat-fixed.tex > virtio-diff.tex perl -pi fixupdiff.pl virtio-diff.tex SPECDOC="${SPECDOC}-diff" rm $SPECDOC.aux $SPECDOC.pdf $SPECDOC.out |