Cmake docbook export: Try to handle quotation marks in parameter values properly

This commit is contained in:
Kornel Benko 2020-08-01 09:40:23 +02:00
parent b62c6e8961
commit decc775834

View 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");