]> git.lyx.org Git - lyx.git/commitdiff
Cmake docbook export: Try to handle quotation marks in parameter values properly
authorKornel Benko <kornel@lyx.org>
Sat, 1 Aug 2020 07:40:23 +0000 (09:40 +0200)
committerKornel Benko <kornel@lyx.org>
Sat, 1 Aug 2020 07:40:23 +0000 (09:40 +0200)
development/autotests/filterXml4Sax.pl

index 4ebb69bb36a4f31be2ca6f4f32b3516f9ed0df66..14cef91ba768b8f539b020bde1b2a344c22d3997 100644 (file)
@@ -69,17 +69,19 @@ sub handlePara($)
   if ($para =~ /^\s*([a-z]+(:[a-z]+)?)\s*=\s*(.*)$/) {
     my $val;
     my ($p, $rest) = ($1, $3);
-    if ($rest =~ /^(\'[^\']*\')(.*)$/) {
+    if ($rest =~ /^(\'([^\']|\\\')*\')(.*)$/) {
       $val = $1;
-      $rest = $2;
+      $rest = $3;
     }
-    elsif ($rest =~ /^(\"[^\"]*\")(.*)$/) {
+    elsif ($rest =~ /^(\"([^\"]|\\\")*\")(.*)$/) {
       $val = $1;
-      $rest = $2;
+      $rest = $3;
     }
     elsif ($rest =~ /^([^\s]+)(.*)$/) {
-      $val = '"' . $1 . '"';
+      my $val1 = $1
       $rest = $2;
+      $val1 =~ s/([\"\'\\])/\\$1/g;
+      $val = '"' . $val1 . '"';
     }
     else {
       die("param error for rest = $rest");