From cb7387db539a526ccd7167f96df355e8eabb6ba1 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Wed, 15 Jun 2005 09:56:37 +0000 Subject: [PATCH] Switched to using PIs instead of comments, because osx and sgml2xml don't preserve comments by default. --- contrib/tools/cloak/cloak | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/contrib/tools/cloak/cloak b/contrib/tools/cloak/cloak index d4171f209..83d4f3ddc 100755 --- a/contrib/tools/cloak/cloak +++ b/contrib/tools/cloak/cloak @@ -33,33 +33,33 @@ my $lines = <$handle>; # if the document has already been cloaked, uncloak it if ($lines =~ m/$comment/ || $0 =~ m/uncloak/) { - $lines =~ s///; # remove comment added by cloak - $lines =~ s//$1/g; # uncloak all cloaked entities - $lines =~ s/--DOCTYPE(.*)_END_SUBSET--/DOCTYPE$1/s; # uncloak DOCTYPE, subset + $lines =~ s/<\?$comment \?>//; # remove comment added by cloak + $lines =~ s/<\?ENT_ (.*?)_ENT\?>/$1/g; # uncloak all cloaked entities + $lines =~ s/\?DOCTYPE(.*)_END_SUBSET\?/!DOCTYPE$1/s; # uncloak DOCTYPE, subset } else { # otherwise, cloak the document - $lines = $lines . "\n\n"; + $lines = $lines . "\n\n"; - $lines =~ s/(\w*&\w+;\w*)//g; # cloak all entities + $lines =~ s/(\w*&\w+;\w*)//g; # cloak all entities # uncloak entities in subset - while ($lines =~ /((.*?'\s*>)/s) { - $lines =~ s/((.*?'\s*>)/$1$2$3/s + while ($lines =~ /((.*?'\s*>)/s) { + $lines =~ s/((.*?'\s*>)/$1$2$3/s } - while ($lines =~ /((.*?'\s*>)/s) { - $lines =~ s/((.*?"\s*>)/$1$2$3/s + while ($lines =~ /((.*?'\s*>)/s) { + $lines =~ s/((.*?"\s*>)/$1$2$3/s } # test to see if there is an internal subset or not, then # cloak DOCTYPE declaration and internal subset (if there is one) if ($lines =~ //s) { - $lines =~ s///s + $lines =~ s//<\?DOCTYPE$1_END_SUBSET\?>/s } else { - $lines =~ s/]*)>//s + $lines =~ s/]*)>/<\?DOCTYPE$1_END_SUBSET\?>/s } } -- 2.40.0