]> granicus.if.org Git - docbook-dsssl/commitdiff
Support nested quotes in entities
authorNorman Walsh <ndw@nwalsh.com>
Wed, 20 Jun 2001 13:08:46 +0000 (13:08 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Wed, 20 Jun 2001 13:08:46 +0000 (13:08 +0000)
cvstools/flatten

index c5d79bcc2d82eaf04af73d4ef54d5e3385eeea88..ef685647c28971309f61d5cfca78e0028ab2c9fc 100755 (executable)
@@ -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;";
        }