diff options
author | Karl Berry <karl@freefriends.org> | 2013-06-26 22:57:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-06-26 22:57:37 +0000 |
commit | 74d78e4c6c1722395be36b5f5db73251a60c8928 (patch) | |
tree | 870fe7efe1324a3cb21ae7672062e9cbac753124 /Build/source/texk | |
parent | 054a745be425b167321d2b5de8451ba62e30535c (diff) |
latexdiff (17jun13)
git-svn-id: svn://tug.org/texlive/trunk@30961 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff-vc.pl | 33 | ||||
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff.pl | 37 |
2 files changed, 44 insertions, 26 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff-vc.pl b/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff-vc.pl index 16b0dea5e7d..56696daada7 100755 --- a/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff-vc.pl +++ b/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff-vc.pl @@ -3,7 +3,7 @@ # latexdiff-vc - wrapper script for applying latexdiff to rcs managed files # and for automatised creation of postscript or pdf from difference file # -# Copyright (C) 2005-12 F J Tilmann (tilmann@gfz-potsdam.de, ftilmann@users.berlios.de) +# Copyright (C) 2005-13 F J Tilmann (tilmann@gfz-potsdam.de, ftilmann@users.berlios.de) # # Project webpages: http://latexdiff.berlios.de/ # CTAN page: http://www.ctan.org/tex-archive/support/latexdiff @@ -25,10 +25,12 @@ # # Detailed usage information at the end of the file # +# version 1.0.3: Bug fix: replace use of system('cp...') with File::Copy::copy (Patch contributed by D. Bremner) +# Quotes around system call file arguments to allow filenames with spaces (Patch contributed by ssteve) # version 1.0.2: - option --so to use latexdiff-so # version 1.0.1 (change version numbering to match that of latexdiff) # - Option --fast to use latexdiff-fast, -# - git support (thanks to Bjørn Magnus Mathisen, Santi Béjar, Pietro Battiston and Stefan Alfredson for patches) - UNTESTED +# - git support (thanks to Bjorn Magnus Mathisen, Santi Béjar, Pietro Battiston and Stefan Alfredson for patches) - UNTESTED # version 0.25: # - bbl is allowed as alternative extension (instead of .tex) # version 0.26a @@ -38,11 +40,13 @@ use Getopt::Long ; use Pod::Usage qw/pod2usage/ ; use File::Temp qw/tempdir/ ; use File::Basename qw/dirname/; +use File::Copy; + use strict ; use warnings ; my $versionstring=<<EOF ; -This is LATEXDIFF-VC 1.0.2 +This is LATEXDIFF-VC 1.0.3 (c) 2005-2012 F J Tilmann EOF @@ -231,20 +235,19 @@ while ( $infile=$file2=shift @files ) { push @tmpfiles,$file1; # compare file with previous version ($revs[0]="") or specified version ### system("$diffcmd$revs[0] $infile| $patchcmd -o$file1") ; - if (system("$diffcmd$revs[0] $infile | $patchcmd -o$file1")==0 and -z $file1 ) { + if (system("$diffcmd$revs[0] \"$infile\" | $patchcmd -o\"$file1\"")==0 and -z $file1 ) { # no differences detected, i.e. file is equal to current version - system("\cp $infile $file1"); + copy($infile,$file1) || die "copy($infile,$file1) failed: $!"; } } elsif ( scalar(@revs) == 2 ) { ($file1=$infile) =~ s/\.(tex|bbl)/-oldtmp-$$.$1/ ; $file2 =~ s/\.(tex|bbl)/-newtmp-$$.$1/ ; push @tmpfiles,$file2; - ; if (system("$diffcmd$revs[1] $infile | $patchcmd -o$file2")==0 and -z $file2 ) { - system("\cp $infile $file2"); + copy($infile,$file2) || die "copy($infile,$file2) failed: $!"; } if (system("$diffcmd$revs[0] $infile | $patchcmd -o$file1")==0 and -z $file1 ) { - system("\cp $infile $file1"); + copy($infile,$file1) || die "copy($infile,$file1) failed: $!"; }; } @@ -275,7 +278,7 @@ while ( $infile=$file2=shift @files ) { } } print "Running $latexdiff\n"; - unless ( system("$latexdiff $options $file1 $file2 > $diff") == 0 ) { + unless ( system("$latexdiff $options \"$file1\" \"$file2\" > \"$diff\"") == 0 ) { print STDERR "Something went wrong in $latexdiff. Deleting $diff and abort\n" ; unlink $diff ; exit(5) }; print "Generated difference file $diff\n"; @@ -299,16 +302,16 @@ foreach $diff ( @difffiles ) { # adapt magically changebar styles to [pdftex] display driver if pdf output was selected if ( $pdf ) { - system("sed \"s/Package\\[dvips\\]/Package[pdftex]/\" $diff > $diff.tmp$$ ; \\mv $diff.tmp$$ $diff"); + system("sed \"s/Package\\[dvips\\]/Package[pdftex]/\" \"$diff\" > \"$diff.tmp$$\" ; \\mv \"$diff.tmp$$\" \"$diff\""); } print STDERR "PDF: $pdf Postscript: $postscript cwd $cwd\n"; - if ( system("grep -q \'^[^%]*\\\\bibliography\' $diff") == 0 ) { + if ( system("grep -q \'^[^%]*\\\\bibliography\' \"$diff\"") == 0 ) { if ( $postscript) { - system("latex --interaction=batchmode $diff; bibtex $diffbase"); + system("latex --interaction=batchmode \"$diff\"; bibtex \"$diffbase\""); push @ptmpfiles, "$diffbase.bbl","$diffbase.bbl" ; } elsif ( $pdf ) { - system("pdflatex --interaction=batchmode $diff; bibtex $diffbase"); + system("pdflatex --interaction=batchmode \"$diff\"; bibtex \"$diffbase\""); push @ptmpfiles, "$diffbase.bbl","$diffbase.bbl" ; } } @@ -317,12 +320,12 @@ foreach $diff ( @difffiles ) { my $dvi="$diffbase.dvi"; my $ps="$diffbase.ps"; - system("latex --interaction=batchmode $diff; latex $diff; dvips -o $ps $dvi"); + system("latex --interaction=batchmode \"$diff\"; latex \"$diff\"; dvips -o $ps $dvi"); push @ptmpfiles, "$diffbase.aux","$diffbase.log",$dvi ; print "Generated postscript file $ps\n"; } elsif ( $pdf ) { - system("pdflatex --interaction=batchmode $diff; pdflatex $diff"); + system("pdflatex --interaction=batchmode \"$diff\"; pdflatex \"$diff\""); push @ptmpfiles, "$diffbase.aux","$diffbase.log"; } unlink @ptmpfiles; diff --git a/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff.pl b/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff.pl index 865fc4853b1..e1f1d9b1b29 100755 --- a/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff.pl +++ b/Build/source/texk/texlive/linked_scripts/latexdiff/latexdiff.pl @@ -22,6 +22,15 @@ # # Detailed usage information at the end of the file # +# Version 1.0.3 +# - fix bug in add_safe_commands that made latexdiff hang on DeclareMathOperator +# command in preamble +# - \(..\) inline math expressions were not parsed correctly, if the contained a linebreak +# - applied patch contributed by tomflannaghan via Berlios: [ Patch #3431 ] Adds correct handling of \left< and \right> +# - \$ is treated correctly as a literal dollar sign (thanks to Reed Cartwright and Joshua Miller for reporting this bug +# and sketching out the solution) +# - \^ and \_ are correctly interpreted as accent and underlined space, respectively, not as superscript of subscript (thanks to Wail Yahyaoui for pointing out this bug) +# # Version 1.0.1 - treat \big,\bigg etc. equivalently to \left and # \right - include starred version in MATHENV - apply # - flatten recursively and --flatten expansion is now @@ -540,8 +549,8 @@ my ($algodiffversion)=split(/ /,$Algorithm::Diff::VERSION); my ($versionstring)=<<EOF ; -This is LATEXDIFF 1.0.2 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) - (c) 2004-2012 F J Tilmann +This is LATEXDIFF 1.0.3 (Algorithm::Diff $Algorithm::Diff::VERSION, Perl $^V) + (c) 2004-2013 F J Tilmann EOF # Configuration variables: these have to be visible from the subroutines @@ -941,12 +950,12 @@ push(@SAFECMDLIST, qr/^QLEFTBRACE$/, qr/^QRIGHTBRACE$/); my $coords= '[\-.,\s\d]*'; # word: sequence of letters or accents followed by letter my $word='(?:[-\w\d*]|\\\\[\"\'\`~^][A-Za-z\*])+'; - my $cmdleftright='\\\\(?:left|right|[Bb]igg?[lrm]?|middle)\s*(?:[()\[\]|]|\\\\(?:[|{}]|\w+))'; + my $cmdleftright='\\\\(?:left|right|[Bb]igg?[lrm]?|middle)\s*(?:[<>()\[\]|]|\\\\(?:[|{}]|\w+))'; my $cmdoptseq='\\\\[\w\d\*]+'.$extraspace.'(?:(?:\['.$brat0.'\]|\{'. $pat6 . '\}|\(' . $coords .'\))'.$extraspace.')*'; my $backslashnl='\\\\\n'; my $oneletcmd='\\\\.\*?(?:\['.$brat0.'\]|\{'. $pat6 . '\})*'; - my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(].*?\\\\[)]'; + my $math='\$(?:[^$]|\\\$)*?\$|\\\\[(](?:.|\n)*?\\\\[)]'; ## the current maths command cannot cope with newline within the math expression my $comment='%.*?\n'; @@ -1180,7 +1189,7 @@ sub add_safe_commands { # get rid of comments my $to_test = ""; # test for \DeclareMathOperator{\foo}{myoperator} - while ( $preamble =~ m/\DeclareMathOperator\s*\{\\(\w*?)\}/s) { + while ( $preamble =~ m/\DeclareMathOperator\s*\*?\{\\(\w*?)\}/osg) { $to_test=$1; if ($to_test ne "" and not iscmd($to_test,\@SAFECMDLIST,\@SAFECMDEXCL) and not iscmd($to_test, \@SAFECMDEXCL, [])) { # one should add $to_test to the list of safe commands. @@ -1885,7 +1894,7 @@ sub marktags { # #. change begin and end commands within comments to BEGINDIF, ENDDIF # so they don't disturb the pattern matching (if there are several \begin or \end in one line # 2. mark all first empty line (in block of several) with \PAR tokens -# 3. Convert all '\%' into '\PERCENTAGE ' to make parsing regular expressions easier +# 3. Convert all '\%' into '\PERCENTAGE ' and all '\$' into \DOLLAR to make parsing regular expressions easier # 4. Convert all \verb|some verbatim text| commands (where | can be an arbitrary character) # into \verb{hash} # 5. Convert \begin{verbatim} some verbatim text \end{verbatim} into \verbatim{hash} @@ -1918,14 +1927,15 @@ sub preprocess { s/\n(\s*?)\n((?:\s*\n)*)/\n$1\\PAR\n$2/g ; s/(?<!\\)\\%/\\PERCENTAGE /g ; # (?<! is negative lookbehind assertion to prevent \\% from being converted + s/(?<!\\)\\\$/\\DOLLAR /g ; # (?<! is negative lookbehind assertion to prevent \\$ from being converted s/(\\verb\*?)(\S)(.*?)\2/"${1}{". tohash(\%verbhash,"${2}${3}${2}") ."}"/esg; s/\\begin\{(verbatim\*?)\}(.*?)\\end\{\1\}/"\\${1}{". tohash(\%verbhash,"${2}") . "}"/esg; # Convert _n or _\cmd into \SUBSCRIPTNB{n} or \SUBSCRIPTNB{\cmd} and _{nnn} into \SUBSCRIPT{nn} - 1 while s/_([^{\\]|\\\w+)/\\SUBSCRIPTNB{$1}/g ; - 1 while s/_{($pat6)}/\\SUBSCRIPT{$1}/g ; + 1 while s/(?<!\\)_([^{\\]|\\\w+)/\\SUBSCRIPTNB{$1}/g ; + 1 while s/(?<!\\)_{($pat6)}/\\SUBSCRIPT{$1}/g ; # Convert ^n into \SUPERSCRIPTNB{n} and ^{nnn} into \SUPERSCRIPT{nn} - 1 while s/\^([^{\\]|\\\w+)/\\SUPERSCRIPTNB{$1}/g ; - 1 while s/\^{($pat6)}/\\SUPERSCRIPT{$1}/g ; + 1 while s/(?<!\\)\^([^{\\]|\\\w+)/\\SUPERSCRIPTNB{$1}/g ; + 1 while s/(?<!\\)\^{($pat6)}/\\SUPERSCRIPT{$1}/g ; # Convert $$ $$ into \begin{DOLLARDOLLAR} \end{DOLLARDOLLAR} s/\$\$(.*?)\$\$/\\begin{DOLLARDOLLAR}$1\\end{DOLLARDOLLAR}/sg; # Convert \[ \] into \begin{SQUAREBRACKET} \end{SQUAREBRACKET} @@ -2022,7 +2032,7 @@ sub fromhash { # 5. Convert \SUPERSCRIPTNB{n} into ^n and \SUPERSCRIPT{nn} into ^{nnn} # 6. Convert \SUBSCRIPTNB{n} into _n and \SUBCRIPT{nn} into _{nnn} # 7. Expand hashes of verb and verbatim environments -# 8. Convert '\PERCENTAGE ' back into '\%' +# 8. Convert '\PERCENTAGE ' back into '\%' and '\DOLLAR ' into '\$' # 9.. remove all \PAR tokens # 10. package specific processing: endfloat: make sure \begin{figure} and \end{figure} are always # on a line by themselves, similarly for table environment @@ -2258,6 +2268,8 @@ sub postprocess { s/\\(verbatim\*?)\{([-\d]*?)\}/"\\begin{${1}}".fromhash(\%verbhash,$2)."\\end{${1}}"/esg; # Convert '\PERCENTAGE ' back into '\%' s/\\PERCENTAGE /\\%/g; + # Convert '\DOLLAR ' back into '\$' + s/\\DOLLAR /\\\$/g; # remove all \PAR tokens (taking care to properly keep commented out PAR's # from introducing uncommented newlines - next line) s/(%DIF < )([^\n]*?)\\PAR\n/$1$2\n$1\n/sg; @@ -3662,8 +3674,11 @@ min Pr sec sup +[Hclbdruvt] (SUPER|SUB)SCRIPTNB (SUPER|SUB)SCRIPT +PERCENTAGE +DOLLAR %%END SAFE COMMANDS %%BEGIN TEXT COMMANDS |