File latexdiff_perl.dif of Package texlive-specs-m

From cfe445c4bff997cdc59979a89da8362cbf403e75 Mon Sep 17 00:00:00 2001
From: Frederik Tilmann <ftilmann@zedat.fu-berlin.de>
Date: Sat, 17 Sep 2016 22:21:08 +0200
Subject: [PATCH] Removed some more unescaped left braces (which triggered
 depracation warnings)

From a83d9cb865fd0d8ba83ae97ce567035d96b015c7 Mon Sep 17 00:00:00 2001
From: Frederik Tilmann <ftilmann@zedat.fu-berlin.de>
Date: Tue, 11 Oct 2016 01:01:46 +0200
Subject: [PATCH] Fix further unescaped left brace warnings; fixes issue #61

---
 texmf-dist/scripts/latexdiff/latexdiff-vc.pl |    9 ++-
 texmf-dist/scripts/latexdiff/latexdiff.pl    |   68 +++++++++++++--------------
 2 files changed, 40 insertions(+), 37 deletions(-)

--- texmf-dist/scripts/latexdiff/latexdiff-vc.pl
+++ texmf-dist/scripts/latexdiff/latexdiff-vc.pl	2016-12-07 11:59:28.999825446 +0000
@@ -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-13  F J Tilmann (tilmann@gfz-potsdam.de)
+#   Copyright (C) 2005-16  F J Tilmann (tilmann@gfz-potsdam.de)
 #
 # Repository:         https://github.com/ftilmann/latexdiff
 # CTAN page:          http://www.ctan.org/tex-archive/support/latexdiff
@@ -26,6 +26,9 @@
 # Detailed usage information at the end of the file
 #
 # TODO/IDEAS: - option to call external pre-processing codes
+#             - choose type of latex processor / bibtex (luatex, xekatex etc)
+# versio 1.2.0:
+#    - depracation fix: left brace in RegEx now needs to be escaped
 #
 # version 1.1.1:
 #    - better detection of RCS system 
@@ -448,10 +451,10 @@ sub findchangedpages {
   my %start;
   open(AUX,$auxfile) or die ("Could open aux file $auxfile . System error: $!");
   while (<AUX>) {
-    if (m/\\zref\@newlabel{DIFchgb(\d*)}{.*\\abspage{(\d*)}}/ ) { 
+    if (m/\\zref\@newlabel\{DIFchgb(\d*)\}\{.*\\abspage\{(\d*)\}\}/ ) { 
       $start{$1}=$2; $pages{$2}=1;
     }
-    if (m/\\zref\@newlabel{DIFchge(\d*)}{.*\\abspage{(\d*)}}/) { 
+    if (m/\\zref\@newlabel\{DIFchge(\d*)\}\{.*\\abspage\{(\d*)\}\}/) { 
       if (defined($start{$1})) {
 	for ($j=$start{$1}; $j<=$2; $j++) {
 	  $pages{$j}=1;
--- texmf-dist/scripts/latexdiff/latexdiff.pl
+++ texmf-dist/scripts/latexdiff/latexdiff.pl	2016-12-07 12:00:38.778401360 +0000
@@ -1465,7 +1465,7 @@ sub flatten {
   $bblfile=~s/\.tex$//;
   $bblfile.=".bbl";
 
-  if ( ($includeonly) = ($preamble =~ m/\\includeonly{(.*?)}/ ) ) {
+  if ( ($includeonly) = ($preamble =~ m/\\includeonly\{(.*?)\}/ ) ) {
     $includeonly =~ s/,/|/g;
   } else {
     $includeonly = '.*?';
@@ -1491,7 +1491,7 @@ sub flatten {
 	    "$begline$newpage$replacement$newpage";
           }/exgm;
   # replace bibliography with bbl file if it exists
-  $text=~s/(^(?:[^%\n]|\\%)*)\\bibliography{(.*?)}/{ 
+  $text=~s/(^(?:[^%\n]|\\%)*)\\bibliography\{(.*?)\}/{ 
            if ( -f $bblfile ){
 	     $replacement=read_file_with_encoding(File::Spec->catfile($bblfile), $encoding);
 	   } else {
@@ -1502,7 +1502,7 @@ sub flatten {
 	   "$begline$replacement";
   }/exgm;
   # replace subfile with contents (subfile package)
-  $text=~s/(^(?:[^%\n]|\\%)*)\\subfile{(.*?)}/{ 
+  $text=~s/(^(?:[^%\n]|\\%)*)\\subfile\{(.*?)\}/{ 
            $begline=(defined($1)? $1 : "") ;
      	   $fname = $2; 
            #      # add tex extension unless there is a three letter extension already 
@@ -2175,15 +2175,15 @@ sub marktags {
 sub take_comments_and_enter_from_frac() {
       ###*************take the \n and % between frac and {}***********
       ###notice all of the substitution are made none global
-      while( m/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\frac(([\s]*%[^\n]*?)*[\r\n|\r|\n])+\{(.*?)\\end{\1}/s ) {
+      while( m/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\frac(([\s]*%[^\n]*?)*[\r\n|\r|\n])+\{(.*?)\\end\{\1}/s ) {
 	### if there isn't any % or \n in the pattern $2 then there should be an \\end{...} in $2
-	if( $2 !~ m/\\end{$1}/s ) {
+	if( $2 !~ m/\\end\{$1}/s ) {
 	  ### take out % and \n from the next match only (none global)
-		s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\frac(([\s]*%[^\n]*?)*[\r\n|\r|\n])+\{(.*?)\\end{\1}/\\begin{$1}$2\\frac{$5\\end{$1}/s;
+		s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\frac(([\s]*%[^\n]*?)*[\r\n|\r|\n])+\{(.*?)\\end\{\1}/\\begin{$1}$2\\frac{$5\\end{$1}/s;
 	}
 	else{
 	  ###there are no more % and \n in $2, we want to find the next one so we clear the begin-end from the pattern
-		s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\end{\1}/MATHBLOCK$1$2MATHBLOCKEND/s;
+		s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\end\{\1}/MATHBLOCK$1$2MATHBLOCKEND/s;
 	}
       }
       ###cleaning up
@@ -2197,18 +2197,18 @@ sub take_comments_and_enter_from_frac()
           ### from now on CURRFRAC is the frac we are looking at
           s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)\\frac\{(.*?)\\end\{\1\}/\\begin\{$1\}$2CURRFRAC\{$3\\end\{$1\}/s;
           while( m/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)CURRFRAC\{(.*?)\\end\{\1\}/s ) {
-             if( m/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)CURRFRAC\{($pat_n)\}([\s]*(%[^\n]*?)*[\r\n|\r|\n])+[\s]*\{(.*?)\\end{\1}/s ) {
+             if( m/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)CURRFRAC\{($pat_n)\}([\s]*(%[^\n]*?)*[\r\n|\r|\n])+[\s]*\{(.*?)\\end\{\1}/s ) {
                    s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)\}(.*?)CURRFRAC\{($pat_n)\}([\s]*(%[^\n]*?)*[\r\n|\r|\n])+[\s]*\{(.*?)\\end\{\1\}/\\begin\{$1\}$2CURRFRAC\{$3\}\{$6\\end\{$1\}/s;
                } 
               else { # there is no comment or \n between the two brackets {}{}
               ### change CURRFRAC to FRACSTART so we can change them all back to //frac{ when we finish
-                   s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)CURRFRAC\{(.*?)\\end{\1}/\\begin{$1}$2FRACSTART\{$3\\end{$1}/s;
+                   s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)CURRFRAC\{(.*?)\\end\{\1}/\\begin{$1}$2FRACSTART\{$3\\end{$1}/s;
               }
             }
         }
         else{
           ###there are no more frac in $2, we want to find the next one so we clear the begin-end from the pattern
-          s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\end{\1}/MATHBLOCK$1$2MATHBLOCKEND/s;
+          s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\end\{\1}/MATHBLOCK$1$2MATHBLOCKEND/s;
         }
         
       }
@@ -2244,8 +2244,8 @@ sub take_comments_and_enter_from_frac()
 sub preprocess {
   for (@_) { 
     #    Change \{ to \QLEFTBRACE, \} to \QRIGHTBRACE, and \& to \AMPERSAND
-    s/(?<!\\)\\{/\\QLEFTBRACE /sg;
-    s/(?<!\\)\\}/\\QRIGHTBRACE /sg;
+    s/(?<!\\)\\\{/\\QLEFTBRACE /sg;
+    s/(?<!\\)\\\}/\\QRIGHTBRACE /sg;
     s/(?<!\\)\\&/\\AMPERSAND /sg;
 # replace {,} in comments with \\CLEFTBRACE,\\CRIGHTBRACE
     1 while s/((?<!\\)%.*)\{(.*)$/$1\\CLEFTBRACE $2/mg ;
@@ -2271,16 +2271,16 @@ sub preprocess {
     s/(?<!\\)\\\[/\\begin{SQUAREBRACKET}/sg;
     s/\\\]/\\end{SQUAREBRACKET}/sg;
     # Convert all picture environmentent (\begin{PICTUREENV} .. \end{PICTUREENV} \PICTUREBLOCKenv
-    s/\\begin{($PICTUREENV)}(.*?)\\end{\1}/\\PICTUREBLOCK$1\{$2\}/sg;
+    s/\\begin\{($PICTUREENV)}(.*?)\\end\{\1}/\\PICTUREBLOCK$1\{$2\}/sg;
     #    For --block-math-markup option -convert all \begin{MATH} .. \end{MATH}
     #    into \MATHBLOCKMATH{...} commands, where MATH is any valid math environment
     #    Also convert all array environments into ARRAYBLOCK environments
     if ( $mathmarkup != FINE ) {
-      s/\\begin{($ARRENV)}(.*?)\\end{\1}/\\ARRAYBLOCK$1\{$2\}/sg;
+      s/\\begin\{($ARRENV)}(.*?)\\end\{\1}/\\ARRAYBLOCK$1\{$2\}/sg;
       
       take_comments_and_enter_from_frac();
       
-      s/\\begin{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\end{\1}/\\MATHBLOCK$1\{$2\}/sg;
+      s/\\begin\{($MATHENV|$MATHARRENV|SQUAREBRACKET)}(.*?)\\end\{\1}/\\MATHBLOCK$1\{$2\}/sg;
     }
     # add final token " STOP"
     $_ .= " STOP"
@@ -2411,7 +2411,7 @@ sub postprocess {
 	# also transform the opposite pair \end{displaymath} .. \begin{displaymath} but we have to be careful not to interfere with the results of the transformation in the line directly above
 	### pre-0.42 obsolete version which did not work on eqnarray test      $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\end\{($MATHENV)\}\s*?\n)(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\begin\{\2\})/$1\\end{$MATHREPL}$AUXCMD\n$3\n\\begin{$MATHREPL}$AUXCMD\n$4/sg;
 	###0.5:      $delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\begin\{\2\})/\\end{MATHMODE}$AUXCMD\n$1$3\n\\begin{MATHMODE}$AUXCMD\n$4/sg;
-	$delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}.*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\begin\{\2\})/\\end{MATHMODE}$AUXCMD\n$1$3\n\\begin{MATHMODE}$AUXCMD\n$4/sg;
+	$delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}.*?(?:$DELCMDCLOSE|\n))(.*?[^\n]?)\n?(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\begin\{\2\})/\\end\{MATHMODE\}$AUXCMD\n$1$3\n\\begin\{MATHMODE\}$AUXCMD\n$4/sg;
   
         # now look for unpaired %DIFDELCMD < \begin{MATHENV}; if found add \begin{$MATHREPL} and insert \end{$MATHREPL} 
         # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted
@@ -2420,8 +2420,8 @@ sub postprocess {
         }
         # now look for unpaired %DIFDELCMD < \end{MATHENV}; if found add \end{MATHMODE} and insert \begin{MATHMODE} 
         # just before end of block; again we use look-behind assertion to avoid matching constructions which have already been converted
-        if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\end{MATHMODE}$AUXCMD\n/sg ) {
-	  $delblock =~ s/(\\DIFdelend$)/\\begin{MATHMODE}$AUXCMD\n$1/s ;
+        if ($delblock=~ s/(?<!${AUXCMD}\n)(\%DIFDELCMD < \s*\\end\{((?:$MATHENV)|SQUAREBRACKET)\}\s*?(?:$DELCMDCLOSE|\n))/$1\\end\{MATHMODE\}$AUXCMD\n/sg ) {
+	  $delblock =~ s/(\\DIFdelend$)/\\begin\{MATHMODE\}$AUXCMD\n$1/s ;
 	}
 
 
@@ -2566,15 +2566,15 @@ sub postprocess {
     # environments) are between the \begin{$MATHENV} and \end{MATHMODE} commands. This is necessary as the minimal matching 
     # is not globally minimal but only 'locally' (matching is beginning from the left side of the string)
     if ( $mathmarkup == FINE ) {
-      1 while s/\\begin{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}((?:.(?!(?:\\end{(?:(?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}|\\begin{MATHMODE})))*?)\\end{MATHMODE}/\\begin{$1}$2\\end{$1}/s;
-      1 while s/\\begin{MATHMODE}((?:.(?!\\end{MATHMODE}))*?)\\end{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}/\\begin{$2}$1\\end{$2}/s;
+      1 while s/\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}((?:.(?!(?:\\end\{(?:(?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}|\\begin\{MATHMODE})))*?)\\end\{MATHMODE}/\\begin{$1}$2\\end{$1}/s;
+      1 while s/\\begin\{MATHMODE}((?:.(?!\\end\{MATHMODE}))*?)\\end\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}/\\begin{$2}$1\\end{$2}/s;
       # convert remaining \begin{MATHMODE} \end{MATHMODE} (and not containing & or \\ )into MATHREPL environments
-      s/\\begin{MATHMODE}((?:(.(?!(?<!\\)\&|\\\\))*)?)\\end{MATHMODE}/\\begin{$MATHREPL}$1\\end{$MATHREPL}/sg;
+      s/\\begin\{MATHMODE\}((?:(.(?!(?<!\\)\&|\\\\))*)?)\\end\{MATHMODE\}/\\begin{$MATHREPL}$1\\end{$MATHREPL}/sg;
       # others into MATHARRREPL
-      s/\\begin{MATHMODE}(.*?)\\end{MATHMODE}/\\begin{$MATHARRREPL}$1\\end{$MATHARRREPL}/sg;
+      s/\\begin\{MATHMODE\}(.*?)\\end\{MATHMODE\}/\\begin{$MATHARRREPL}$1\\end{$MATHARRREPL}/sg;
 
       # now look for AUXCMD math-mode pairs which have only comments (or empty lines between them), and remove the added commands
-      s/\\begin{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\end{\1}$AUXCMD\n/$2/sg;       
+      s/\\begin\{((?:$MATHENV)|(?:$MATHARRENV)|SQUAREBRACKET)}$AUXCMD\n((?:\s*%.[^\n]*\n)*)\\end{\1}$AUXCMD\n/$2/sg;       
     } else {
       #   math modes OFF,WHOLE,COARSE: Convert \MATHBLOCKmath{..} commands back to environments
       s/\\MATHBLOCK($MATHENV|$MATHARRENV|SQUAREBRACKET)\{($pat_n)\}/\\begin{$1}$2\\end{$1}/sg;
@@ -2652,27 +2652,27 @@ sub postprocess {
     # undo renaming of the \begin and \end,{,}  and dollars in comments 
     1 while s/(%.*)DOLLARDIF/$1\$/mg ;
 #   Convert \begin{SQUAREBRACKET} \end{SQUAREBRACKET} into \[ \]
-    s/\\end{SQUAREBRACKET}/\\\]/sg;
-    s/\\begin{SQUAREBRACKET}/\\\[/sg;
+    s/\\end\{SQUAREBRACKET\}/\\\]/sg;
+    s/\\begin\{SQUAREBRACKET\}/\\\[/sg;
 # 4. Convert \begin{DOLLARDOLLAR} \end{DOLLARDOLLAR} into $$ $$
     s/\\begin\{DOLLARDOLLAR\}(.*?)\\end\{DOLLARDOLLAR\}/\$\$$1\$\$/sg;
 # 5. Convert  \SUPERSCRIPTNB{n} into ^n  and  \SUPERSCRIPT{nn} into ^{nnn}
-    1 while s/\\SUPERSCRIPT(\s*{($pat_n)})/^$1/g ;
-    1 while s/\\SUPERSCRIPTNB{(\s*$pat0)}/^$1/g ;
+    1 while s/\\SUPERSCRIPT(\s*\{($pat_n)\})/^$1/g ;
+    1 while s/\\SUPERSCRIPTNB\{(\s*$pat0)\}/^$1/g ;
     # Convert  \SUBSCRIPNB{n} into _n  and  \SUBCRIPT{nn} into _{nnn}
-    1 while s/\\SUBSCRIPT(\s*{($pat_n)})/_$1/g ;
-    1 while s/\\SUBSCRIPTNB{(\s*$pat0)}/_$1/g ;
+    1 while s/\\SUBSCRIPT(\s*\{($pat_n)\})/_$1/g ;
+    1 while s/\\SUBSCRIPTNB\{(\s*$pat0)\}/_$1/g ;
     # Convert  \SQRT{n} into \sqrt{n}  and  \SQRTNB{nn} into \sqrt nn
-    1 while s/\\SQRT(\s*{($pat_n)})/\\sqrt$1/g ;
-    1 while s/\\SQRTNB{(\s*$pat0)}/\\sqrt$1/g ;
+    1 while s/\\SQRT(\s*\{($pat_n)\})/\\sqrt$1/g ;
+    1 while s/\\SQRTNB\{(\s*$pat0)\}/\\sqrt$1/g ;
  
     1 while s/(%.*)\\CRIGHTBRACE (.*)$/$1\}$2/mg ;
     1 while s/(%.*)\\CLEFTBRACE (.*)$/$1\{$2/mg ;
 
 
 #    Change \QLEFTBRACE, \QRIGHTBRACE to \{,\}
-    s/\\QLEFTBRACE /\\{/sg;
-    s/\\QRIGHTBRACE /\\}/sg;
+    s/\\QLEFTBRACE /\\\{/sg;
+    s/\\QRIGHTBRACE /\\\}/sg;
     s/\\AMPERSAND /\\&/sg;
 
   return;
@@ -4303,7 +4303,7 @@ institute
 \providecommand{\DIFaddend}{\protect\marginpar{]}}
 \providecommand{\DIFdelbegin}{\protect\marginpar{d[}}
 \providecommand{\DIFdelend}{\protect\marginpar{]}}
-%DIF END BRACKET PREAMBLE
+%DIF END MARGIN PREAMBLE
 
 %DIF DVIPSCOL PREAMBLE
 %Note: only works with dvips converter
openSUSE Build Service is sponsored by