Correction de warnings (left brace escaping)
authorHugo Villeneuve <hugo@hugovil.com>
Thu, 18 Nov 2021 03:31:12 +0000 (22:31 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Wed, 9 Mar 2022 22:14:43 +0000 (17:14 -0500)
...Unescaped left brace in regex is deprecated here...

gtx2tex.pl

index 668cdf5..d4bfed5 100644 (file)
@@ -299,7 +299,7 @@ sub directive{
     }elsif ( /{even}/ ) {
         print TEX "\\ifthenelse{\\isodd{\\thepage}}{}{\\newpage ~}";
     }elsif ( /{title:|{t:/ ) {
-        s/({.*:)(.+)(})/\2/;
+        s/(\{.*:)(.+)(\})/\2/;
         if ( $document_class eq "book" ){
             print TEX "$define" unless ( $lyrics );
         }
@@ -312,22 +312,22 @@ sub directive{
         $song_title = $_;
         $verbose && print TEX "\\typeout{$_}";
     }elsif ( /{subtitle:|{st:/ ) {
-        s/({.*:)(.+)(})/\2/;
+        s/(\{.*:)(.+)(\})/\2/;
         print TEX "\\index{$_!$song_title}";
         print TEX "\\begin{center}$_\\end{center}\n";
     }elsif ( /{margin:|{m:/ ) {
-        s/({.*:)(.+)(})/\2/;
+        s/(\{.*:)(.+)(\})/\2/;
         print TEX "\\marginpar{$_}\n";
     }elsif ( /{comment:|{c:/ ) {
-        s/({.*:)(.+)(})/\2/;
+        s/(\{.*:)(.+)(\})/\2/;
         print TEX "\\textit{$_}\\\\\n" unless ( $lyrics );
     }elsif ( /{second:|{2:/ ) {
-        s/({.*:)(.+)(})/\2/;
+        s/(\{.*:)(.+)(\})/\2/;
         s/\s/$space/g; #Leerzeichen durch feste Leerzeichen ersetzen
         print TEX "\\colorbox{second_back}{\\textcolor{second_text}{$_}}\\\\\n" unless ( $lyrics );
     }elsif ( /{chapter:/ ) {
         $chaptercount++;
-        s/({.*:)(.+)(})/\2/;
+        s/(\{.*:)(.+)(\})/\2/;
         if ( $document_class eq "book" ) {
             print TEX "$define" unless ( $lyrics );
             $define = "";
@@ -369,7 +369,7 @@ sub directive{
 
 sub newtab {
     if ( /{guitartab:/ ) { $guitartab="yes" } else { $guitartab ="no" };
-    s/({.*:)(.+)(})/\2/;
+    s/(\{.*:)(.+)(\})/\2/;
     s/\]\[/\]~~~\[/g;       #fill in fixed spaces between notes
     s/\_/~~~/g;             #fill in extra space
     s/\s/~/g;               #replace spaces with fixed spaced
@@ -418,47 +418,47 @@ sub latex_header {
         if ( /^{/ ) {  # nur Zeilen mit Direktiven bearbeiten
             chomp;
             if ( /{book_title:/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $title = $_ ;
             }elsif ( /{book_author:/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $author = $_ ;
             }elsif ( /{book_date:/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $date = $_ ;
             }elsif ( /{document_class:/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $document_class = $_ ;
                 $verbose && print "Document_class: $document_class\n";
                 if ( $document_class ne "book" && $document_class ne "article" ) {
                     die "parameter of directive document_class must be \"book\" or \"article\"\n";
                 }
             }elsif ( /{font_size:/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $font_size = $_ ;
             }elsif ( /{color_chorus:/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $color_chorus = $_ ;
             }elsif ( /{color_bridge:/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $color_bridge = $_ ;
             }elsif ( /{color_instr:/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $color_instr = $_ ;
             }elsif ( /{color_tab:/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $color_tab = $_ ;
             }elsif ( /{color_second:/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $color_second = $_ ;
             }elsif ( /{color_second_back:/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $color_second_back = $_ ;
             }elsif ( /{geometry:|{g:/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $geometry .= "$_," ;
             }elsif ( /{preamble:|{p:/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $preamble .= "$_\n" ;
             }elsif ( /{musixtex}/ ) {
                 $musixtex = "yes";
@@ -467,7 +467,7 @@ sub latex_header {
             }elsif ( /{tabdefs}/ ) {
                 $tabdefs = "yes";
             }elsif ( /{chapter/ ) {
-                s/({.*:)(.+)(})/\2/;
+                s/(\{.*:)(.+)(\})/\2/;
                 $chaptercount++;
                 push @titlecount, (0);
             }elsif ( /{title:|{t:/ ) {
@@ -686,7 +686,7 @@ sub includes{
     while ( <CHORDPRO> ){
         if ( /{include:/ ) {           #read only lines with an include directive
             chomp;  # avoid \n on last field
-            s/({.*:)(.+)(})/\2/;
+            s/(\{.*:)(.+)(\})/\2/;
             print TMP "#$_\n#\n";
 
             open ( INSERT, '<', "$dirname/$_" ) || die "cannot open include file: $_";