[LyX/master] Cmake docbook export: Try to handle quotation marks in parameter values properly

Kornel Benko kornel at lyx.org
Sat Aug 1 07:17:57 UTC 2020


commit decc775834b2f45c8db10474f634e00fcb9850a2
Author: Kornel Benko <kornel at lyx.org>
Date:   Sat Aug 1 09:40:23 2020 +0200

    Cmake docbook export: Try to handle quotation marks in parameter values properly
---
 development/autotests/filterXml4Sax.pl |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/development/autotests/filterXml4Sax.pl b/development/autotests/filterXml4Sax.pl
index 4ebb69b..14cef91 100644
--- a/development/autotests/filterXml4Sax.pl
+++ b/development/autotests/filterXml4Sax.pl
@@ -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");


More information about the lyx-cvs mailing list