]> git.lyx.org Git - lyx.git/blobdiff - development/autotests/filterXml4Sax.pl
Cmake tests: Do not remove temporary data while debugging
[lyx.git] / development / autotests / filterXml4Sax.pl
index 7004b3315f9bb32a2d53e518de4592a631a27a8d..100039d199bbb1d4aac4dcdb846cd979b8689bdb 100644 (file)
@@ -10,7 +10,7 @@ die("No xml file specified") if (! defined($ARGV[0]));
 my $f = $ARGV[0];
 die("Bad extension of $f") if ($f !~ /\.xml$/);
 die("Could not read $f") if (!open(FI, $f));
-my ($fh, $filename) = tempfile("tempXXXX", SUFFIX => '.xml', DIR => '/tmp', UNLINK => 0);
+my ($fh, $filename) = tempfile("tempXXXX", SUFFIX => '.xml', UNLINK => 0);
 while (my $l = <FI>) {
   chomp($l);
   $l = convert($l);
@@ -29,8 +29,7 @@ else {
   $err = 1;
   @errors = ("Could not run xmllint\n");
 }
-#unlink($filename);
-print "Not unlinking $filename\n";
+unlink($filename);
 if ($err > 0) {
   die(join('', @errors));
 }
@@ -70,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");