Skip to content

Commit 50ee675

Browse files
committed
[css2] Now also extracts XML examples.
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%401290
1 parent 1826376 commit 50ee675

2 files changed

Lines changed: 38 additions & 6 deletions

File tree

css2/bin/Attic/xextr

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# and put their contents into separate files
77
#
88
# Arnaud Le Hors - lehors@w3.org
9-
# $Id: xextr,v 1.2 1998-01-08 13:53:38 ijacobs Exp $
9+
# $Id: xextr,v 1.3 1998-03-20 22:09:14 bbos Exp $
1010

1111
$PROGNAME = substr($0, rindex($0, "/") + 1);
1212

@@ -82,14 +82,30 @@ sub process_html_block {
8282
}
8383

8484
sub process_xml_block {
85-
warn "XML extraction not implemented yet...\n";
85+
my ($file, $block, $deprecated) = @_;
86+
87+
# comment out undesired block
88+
$block =~ s/<em>(.*?)<\/em>/<!-- $1 -->/sigo;
89+
90+
# map characters
91+
$block =~ s/&lt;/</g;
92+
$block =~ s/&gt;/>/g;
93+
$block =~ s/&quot;/\"/g;
94+
$block =~ s/&copy;/(C)/g;
95+
$block =~ s/&amp;/\&/g;
96+
97+
# print file out
98+
print "\tXML extracting $file\n";
99+
open(OUTPUT, "> $file") || die "failed to create $file\n";
100+
print OUTPUT $block;
101+
close(OUTPUT);
86102
}
87103

88104
sub process_css_block {
89105
my ($file, $block, $deprecated) = @_;
90106

91107
# comment out undesired block
92-
$block =~ s/<em>(.*?)<\/em>/<!-- $1 -->/sigo;
108+
$block =~ s|<em>(.*?)</em>|/* $1 */|sigo;
93109

94110
# map characters
95111
$block =~ s/&lt;/</g;

css2/bin/xextr

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# and put their contents into separate files
77
#
88
# Arnaud Le Hors - lehors@w3.org
9-
# $Id: xextr,v 1.2 1998-01-08 13:53:38 ijacobs Exp $
9+
# $Id: xextr,v 1.3 1998-03-20 22:09:14 bbos Exp $
1010

1111
$PROGNAME = substr($0, rindex($0, "/") + 1);
1212

@@ -82,14 +82,30 @@ sub process_html_block {
8282
}
8383

8484
sub process_xml_block {
85-
warn "XML extraction not implemented yet...\n";
85+
my ($file, $block, $deprecated) = @_;
86+
87+
# comment out undesired block
88+
$block =~ s/<em>(.*?)<\/em>/<!-- $1 -->/sigo;
89+
90+
# map characters
91+
$block =~ s/&lt;/</g;
92+
$block =~ s/&gt;/>/g;
93+
$block =~ s/&quot;/\"/g;
94+
$block =~ s/&copy;/(C)/g;
95+
$block =~ s/&amp;/\&/g;
96+
97+
# print file out
98+
print "\tXML extracting $file\n";
99+
open(OUTPUT, "> $file") || die "failed to create $file\n";
100+
print OUTPUT $block;
101+
close(OUTPUT);
86102
}
87103

88104
sub process_css_block {
89105
my ($file, $block, $deprecated) = @_;
90106

91107
# comment out undesired block
92-
$block =~ s/<em>(.*?)<\/em>/<!-- $1 -->/sigo;
108+
$block =~ s|<em>(.*?)</em>|/* $1 */|sigo;
93109

94110
# map characters
95111
$block =~ s/&lt;/</g;

0 commit comments

Comments
 (0)