Skip to content

Commit 78dc648

Browse files
committed
[css2] Added option -x to addlinks, to suppress class=noxref (used for propidx.html)
--HG-- extra : convert_revision : svn%3A73dc7c4b-06e6-40f3-b4f7-9ed1dbc14bfc/trunk%401080
1 parent 60836e2 commit 78dc648

3 files changed

Lines changed: 43 additions & 17 deletions

File tree

css2/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Makefile to generate the CSS2 document based on its "source files"
22
# Arnaud Le Hors - lehors@w3.org
3-
# $Id: Makefile,v 2.11 1998-02-23 16:55:53 ijacobs Exp $
3+
# $Id: Makefile,v 2.12 1998-02-24 02:06:01 bbos Exp $
44

55
# what needs to be set for every new release:
66
# Note use of full year (1998) in identifier.
@@ -380,7 +380,7 @@ propidx.srd: propidx.src build/propidx.srb
380380
propidx.html: propidx.srd Project.cfg
381381
@echo "=========== making" $@
382382
$(ADDHANCH) -r $*.html $(HEADINGDB) $*.srd |\
383-
$(ADDLINKS) $(VALUEDB) - propinst-/propdef- descinst-/descdef- value-inst-/value-def- |\
383+
$(ADDLINKS) -x $(VALUEDB) - propinst-/propdef- descinst-/descdef- value-inst-/value-def- |\
384384
$(ADDNAVBAR) -r $@ |\
385385
$(MKCHAIN) -r $@ - $@
386386

@@ -394,7 +394,7 @@ descidx.srd: descidx.src build/descidx.srb
394394
descidx.html: descidx.srd Project.cfg
395395
@echo "=========== making" $@
396396
$(ADDHANCH) -r $*.html $(HEADINGDB) $*.srd |\
397-
$(ADDLINKS) $(VALUEDB) - propinst-/propdef- descinst-/descdef- value-inst-/value-def- |\
397+
$(ADDLINKS) -x $(VALUEDB) - propinst-/propdef- descinst-/descdef- value-inst-/value-def- |\
398398
$(ADDNAVBAR) -r $@ |\
399399
$(MKCHAIN) -r $@ - $@
400400

css2/bin/Attic/addlinks

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@
22
# Add links from instances to definitions
33
# Write to stdout
44
#
5+
# -x allow html2ps to add crossrefs (page numbers)
6+
# dbase DBM file created by mkanchdb
7+
# file input file
8+
# ins-class/def-class links will be created from every occurrence
9+
# of ins-class to occurrence of def-class (as found
10+
# in dbase)
11+
#
512
# Arnaud Le Hors - lehors@w3.org
6-
# $Id: addlinks,v 2.2 1998-02-16 23:40:26 bbos Exp $
13+
# Modifications by Bert Bos <bert@w3.org>
14+
# $Id: addlinks,v 2.3 1998-02-24 02:07:43 bbos Exp $
715

16+
use Getopt::Std;
817
use lib 'bin';
918
use utils;
1019

1120
$PROG = substr($0, rindex($0, "/") + 1);
12-
$USAGE = "Usage: $PROG dbase file [ins-class/def-class [ins-class/def-class...]]\n";
21+
$USAGE = "Usage: $PROG [-x] dbase file [ins-class/def-class [ins-class/def-class...]]\n";
1322

1423
# $1=starttag, $2=class excl. prefix, $3=contents, $4=endtag
1524
$pre = '(<span\s+[^>]*?class\s*=\s*[\"\']?';
@@ -37,8 +46,9 @@ sub rpath {
3746

3847
# Find the URL for $_[0] in %anchors, create <A> around/in element
3948
sub gen_anch {
40-
my ($key, $stag, $content, $etag) = @_;
49+
my ($key, $stag, $content, $etag, $xrefon) = @_;
4150
my $anch = $anchors{$key};
51+
if ($xrefon) {$class = "";} else {$class = " class=\"noxref\"";}
4252
if (! defined $anch) {
4353
warn "$PROG: index $_[0] not found\n";
4454
$anch = "";
@@ -51,23 +61,26 @@ sub gen_anch {
5161
return "$stag$content$etag";
5262
} elsif ($content =~ /^<a\b/sio) {
5363
# An A, but without HREF, at the start, add HREF to existing <A>
54-
return "$stag<a href=\"$anch\" class=\"noxref\"$'$etag";
64+
return "$stag<a href=\"$anch\"$class$'$etag";
5565
} elsif ($content =~ /<a\b/sio) {
5666
# An A not at the start, add <A> before the existing one
57-
return "$stag<a href=\"$anch\" class=\"noxref\">$`</a>$&$'$etag";
67+
return "$stag<a href=\"$anch\"$class>$`</a>$&$'$etag";
5868
} else {
5969
# No <A> in content, enclose whole element
60-
return "<a href=\"$anch\" class=\"noxref\">$stag$content$etag</a>";
70+
return "<a href=\"$anch\"$class>$stag$content$etag</a>";
6171
}
6272
}
6373

6474
### main
6575

76+
getopts('x') or die $USAGE;
6677
($dbase = $ARGV[0]) || die $USAGE;
6778
shift;
6879
($file = $ARGV[0]) || die $USAGE;
6980
shift;
7081

82+
my $xrefon = defined $opt_x;
83+
7184
dbmopen(%anchors, $dbase, 0666) || die "$PROG: cannot open database $dbase\n";
7285

7386
# Load file
@@ -76,7 +89,7 @@ $buf = readfile($file);
7689
# Loop over class/dbase pairs
7790
while (($class1, $class2) = split(/\//, $ARGV[0])) {
7891
shift;
79-
$buf =~ s/$pre$class1$post/gen_anch("$class2$2", $1, $3, $4)/sieg;
92+
$buf =~ s/$pre$class1$post/gen_anch("$class2$2", $1, $3, $4, $xrefon)/sieg;
8093
}
8194
dbmclose(%anchors);
8295

css2/bin/addlinks

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@
22
# Add links from instances to definitions
33
# Write to stdout
44
#
5+
# -x allow html2ps to add crossrefs (page numbers)
6+
# dbase DBM file created by mkanchdb
7+
# file input file
8+
# ins-class/def-class links will be created from every occurrence
9+
# of ins-class to occurrence of def-class (as found
10+
# in dbase)
11+
#
512
# Arnaud Le Hors - lehors@w3.org
6-
# $Id: addlinks,v 2.2 1998-02-16 23:40:26 bbos Exp $
13+
# Modifications by Bert Bos <bert@w3.org>
14+
# $Id: addlinks,v 2.3 1998-02-24 02:07:43 bbos Exp $
715

16+
use Getopt::Std;
817
use lib 'bin';
918
use utils;
1019

1120
$PROG = substr($0, rindex($0, "/") + 1);
12-
$USAGE = "Usage: $PROG dbase file [ins-class/def-class [ins-class/def-class...]]\n";
21+
$USAGE = "Usage: $PROG [-x] dbase file [ins-class/def-class [ins-class/def-class...]]\n";
1322

1423
# $1=starttag, $2=class excl. prefix, $3=contents, $4=endtag
1524
$pre = '(<span\s+[^>]*?class\s*=\s*[\"\']?';
@@ -37,8 +46,9 @@ sub rpath {
3746

3847
# Find the URL for $_[0] in %anchors, create <A> around/in element
3948
sub gen_anch {
40-
my ($key, $stag, $content, $etag) = @_;
49+
my ($key, $stag, $content, $etag, $xrefon) = @_;
4150
my $anch = $anchors{$key};
51+
if ($xrefon) {$class = "";} else {$class = " class=\"noxref\"";}
4252
if (! defined $anch) {
4353
warn "$PROG: index $_[0] not found\n";
4454
$anch = "";
@@ -51,23 +61,26 @@ sub gen_anch {
5161
return "$stag$content$etag";
5262
} elsif ($content =~ /^<a\b/sio) {
5363
# An A, but without HREF, at the start, add HREF to existing <A>
54-
return "$stag<a href=\"$anch\" class=\"noxref\"$'$etag";
64+
return "$stag<a href=\"$anch\"$class$'$etag";
5565
} elsif ($content =~ /<a\b/sio) {
5666
# An A not at the start, add <A> before the existing one
57-
return "$stag<a href=\"$anch\" class=\"noxref\">$`</a>$&$'$etag";
67+
return "$stag<a href=\"$anch\"$class>$`</a>$&$'$etag";
5868
} else {
5969
# No <A> in content, enclose whole element
60-
return "<a href=\"$anch\" class=\"noxref\">$stag$content$etag</a>";
70+
return "<a href=\"$anch\"$class>$stag$content$etag</a>";
6171
}
6272
}
6373

6474
### main
6575

76+
getopts('x') or die $USAGE;
6677
($dbase = $ARGV[0]) || die $USAGE;
6778
shift;
6879
($file = $ARGV[0]) || die $USAGE;
6980
shift;
7081

82+
my $xrefon = defined $opt_x;
83+
7184
dbmopen(%anchors, $dbase, 0666) || die "$PROG: cannot open database $dbase\n";
7285

7386
# Load file
@@ -76,7 +89,7 @@ $buf = readfile($file);
7689
# Loop over class/dbase pairs
7790
while (($class1, $class2) = split(/\//, $ARGV[0])) {
7891
shift;
79-
$buf =~ s/$pre$class1$post/gen_anch("$class2$2", $1, $3, $4)/sieg;
92+
$buf =~ s/$pre$class1$post/gen_anch("$class2$2", $1, $3, $4, $xrefon)/sieg;
8093
}
8194
dbmclose(%anchors);
8295

0 commit comments

Comments
 (0)