From ccac3cdd0b8ee5d59618c52fa67006037042441f Mon Sep 17 00:00:00 2001 From: mstsirkin Date: Thu, 26 Jun 2014 12:35:17 +0000 Subject: script to create html diff as well git-svn-id: https://tools.oasis-open.org/version-control/svn/virtio@392 0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652 --- makediff.sh | 39 +++++++++++++++++++++++++++++++++++++++ makediffhtml.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ makediffpdf.sh | 37 +------------------------------------ 3 files changed, 94 insertions(+), 36 deletions(-) create mode 100755 makediff.sh create mode 100755 makediffhtml.sh diff --git a/makediff.sh b/makediff.sh new file mode 100755 index 0000000..460b593 --- /dev/null +++ b/makediff.sh @@ -0,0 +1,39 @@ +#make pdf diff using latexpand and latexdiff-fast +#preamble in diffpreamble.tex +#in diff, links are coloured green instead of blue +MAIN=$1 +PATH=.:${PATH} +cur="$PWD" +rm -fr old new +git clone $PWD old +cd "${cur}/old" +git checkout ec1ffbf27a8f0a06ca65cd498a69c7f89bd97dc1 +mv specvars.tex specvars-orig.tex +#make links green to avoid confusion +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 +#chmod +x latexpand +latexpand $MAIN -o flat.tex +cd "${cur}" +git clone $PWD new +cd "${cur}/new" +mv specvars.tex specvars-orig.tex +#make links green to avoid confusion +sed s/blue/pinegreen/ specvars-orig.tex > specvars.tex +SPECDOC=${SPECDOC:-`cat REVISION`} +./make-setup-generated.sh "$SPECDOC" +latexpand $MAIN -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 --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 diff --git a/makediffhtml.sh b/makediffhtml.sh new file mode 100755 index 0000000..18260ed --- /dev/null +++ b/makediffhtml.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +./makediff.sh virtio-html.tex + +SPECDOC=${SPECDOC:-`cat REVISION`} +SPECDOC="${SPECDOC}-diff" + +./make-setup-generated.sh "$SPECDOC" + +cp virtio-diff.tex $SPECDOC.tex + +#uncomment if you have a broken t4ht +#PATH=./t4ht-workaround:${PATH} htlatex $SPECDOC.tex "virtiohtml,info,charset=utf-8" " -cunihtf -utf8" +htlatex $SPECDOC.tex "virtio-html,info,charset=utf-8,fn-in" " -cunihtf -utf8" + +rm $SPECDOC.tex + +rm $SPECDOC.aux +mv $SPECDOC.html $SPECDOC.tmp1 + +sed 's/~~/"/g' $SPECDOC.tmp1 >$SPECDOC.tmp2 +sed 's/>~/>"/g' $SPECDOC.tmp2 >$SPECDOC.tmp3 +sed 's/>=~/>="/g' $SPECDOC.tmp3 >$SPECDOC.tmp4 +sed 's/~$SPECDOC.tmp5 + +# If font paths are misconfigured, we get ligatures +# (such as 'ff or 'fi') replaced by NULL character in output. +# This in not a valid HTML output, so detect this and warn user. +# For detection, we rely on the fact that file utility +# recognizes files with NULL characters as binary data. +if test `file -b $SPECDOC.tmp5` = 'data'; +then + echo + echo WARNING! + echo + echo NULL characters detected in file output. + echo This is likely due to tex4ht being unable to find font files. + echo If installed, you might need to fix font file paths + echo for tex4ht by locating tex4ht.env file in your setup + echo correcting font file paths there and copying it to + echo tex4ht.env or .tex4ht in your home directory. + echo + echo WARNING! + echo Proceeding but HTML output appears to be malformed. + echo +fi + +mv $SPECDOC.tmp5 $SPECDOC.html +rm $SPECDOC.tmp* + +#uncomment if you have a broken t4ht +#cp ./t4ht-workaround/virtio-v1.0-csd01.css $SPECDOC.css + +zip $SPECDOC.zip $SPECDOC*.html $SPECDOC.css images/*.png diff --git a/makediffpdf.sh b/makediffpdf.sh index cb84d07..c7864df 100755 --- a/makediffpdf.sh +++ b/makediffpdf.sh @@ -1,41 +1,6 @@ #make pdf diff using latexpand and latexdiff-fast -#preamble in diffpreamble.tex -#in diff, links are coloured green instead of blue -PATH=.:${PATH} -cur="$PWD" -rm -fr old new -git clone $PWD old -cd "${cur}/old" -git checkout ec1ffbf27a8f0a06ca65cd498a69c7f89bd97dc1 -mv specvars.tex specvars-orig.tex -#make links green to avoid confusion -sed s/blue/pinegreen/ specvars-orig.tex > specvars.tex +./makediff.sh virtio.tex SPECDOC=${SPECDOC:-`cat REVISION`} -./make-setup-generated.sh "$SPECDOC" -#wget http://www.ctan.org/pkg/latexpand -#chmod +x latexpand -latexpand virtio.tex -o flat.tex -cd "${cur}" -git clone $PWD new -cd "${cur}/new" -mv specvars.tex specvars-orig.tex -#make links green to avoid confusion -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 --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 xelatex --jobname $SPECDOC virtio-diff.tex -- cgit v1.2.3