From: Norman Walsh Date: Wed, 20 Jun 2001 13:08:46 +0000 (+0000) Subject: Support nested quotes in entities X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4a425c70233128a53e111871b9b39272475648ff;p=docbook-dsssl Support nested quotes in entities --- diff --git a/cvstools/flatten b/cvstools/flatten index c5d79bcc2..ef685647c 100755 --- a/cvstools/flatten +++ b/cvstools/flatten @@ -161,8 +161,9 @@ sub handle { $entity{$ent} = "%%%"; } - } elsif ($decl =~ /^ENTITY % (\S+)\s+[\'\"](.*?)[\'\"]/s) { - my($ent, $val) = ($1, $2); + } elsif ($decl =~ /^ENTITY % (\S+)\s+([\'\"])(.*?)\2/s) { + my($ent, $val) = ($1, $3); + if (!exists($entity{$ent})) { $entity{$ent} = $val; @@ -171,8 +172,8 @@ sub handle { # $used{$ent} = 1; # } } - } elsif ($decl =~ /^ENTITY\s+(\S+)\s+[\'\"](.*?)[\'\"]/s) { - my($ent, $val) = ($1, $2); + } elsif ($decl =~ /^ENTITY\s+(\S+)\s+([\'\"])(.*?)\2/s) { + my($ent, $val) = ($1, $3); if (!exists($entity{$ent})) { $entity{$ent} = $val; $used{$ent} = 1; @@ -224,8 +225,8 @@ sub output { &read_dtd($3); } } - } elsif ($decl =~ /^ENTITY % (\S+)\s+[\'\"](.*?)[\'\"]/s) { - my($ent, $val) = ($1, $2); + } elsif ($decl =~ /^ENTITY % (\S+)\s+([\'\"])(.*?)\2/s) { + my($ent, $val) = ($1, $3); # print "ot: $ent = ", $used{$ent}, "\n"; $decl = &trim_null($decl); @@ -236,8 +237,8 @@ sub output { } $entity{$ent} = $val; } - } elsif ($decl =~ /^ENTITY\s+(\S+)\s+[\'\"](.*?)[\'\"]/s) { - my($ent, $val) = ($1, $2); + } elsif ($decl =~ /^ENTITY\s+(\S+)\s+([\'\"])(.*?)\2/s) { + my($ent, $val) = ($1, $3); if (!exists($entity{$ent})) { if ($val ne '' || $ent =~ /^local\./) { @@ -275,6 +276,8 @@ sub trim_null { $ent = $2; $decl = $'; +# print STDERR "entity{$ent} = $entity{$ent}\n"; + if ($entity{$ent} ne '' || $ent =~ /^local\./) { $new .= "%$ent;"; }