User: adrian
Date: 05/02/01 09:17:58
Modified: xemacs-builds/adrian/website HTMLindex.pl
Log:
sub skip_index to return success or failure.
sub insert_index to improve quoting of @cmd_line.
sub main to use return value of sub skip_index.
Revision Changes Path
1.56 +19 -14 XEmacs/xemacs-builds/adrian/website/HTMLindex.pl
(In the diff below, changes in quantity of whitespace are not shown.)
Index: HTMLindex.pl
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs-builds/adrian/website/HTMLindex.pl,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- HTMLindex.pl 2003/03/18 19:43:44 1.55
+++ HTMLindex.pl 2005/02/01 08:17:57 1.56
@@ -5,7 +5,7 @@
#
# Adrian Aichner, Teradyne GmbH. Munich, Sat, May. 06 1995.
#
-# $Id: HTMLindex.pl,v 1.55 2003/03/18 19:43:44 adrian Exp $
+# $Id: HTMLindex.pl,v 1.56 2005/02/01 08:17:57 adrian Exp $
#
# Functionality common to indexing HTML and XML files.
@@ -28,7 +28,7 @@
use vars qw($VERSION @EXPORT @EXPORT_OK %EXPORT_TAGS);
# $VERSION = 1.00;
# if using RCS/CVS, this may be preferred
- $VERSION = do { my @r = (q$Revision: 1.55 $ =~ /\d+/g); sprintf
"%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
+ $VERSION = do { my @r = (q$Revision: 1.56 $ =~ /\d+/g); sprintf
"%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
@EXPORT = qw();
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@@ -121,17 +121,18 @@
my $self = $_[0];
# Old index intro up to 1.50.
if
(m|<p>This\s+<a(\s+id=\"index\")?\s+name=\"index\"(\s+shape=\"rect\")?>index</a>\s+was\s+generated\s+by|i
- .. m|<hr/?>|i) {
- next;
+ .. m|<hr\s*/?>|i) {
+ return 1;
}
# New index intro as of 1.51.
if (m|<h1 id=\"index\">Document Index</h1>|i
- .. m|<hr/?>|i) {
- next;
+ .. m|<hr\s*/?>|i) {
+ return 1;
}
if (m|<p><a
href=\"\#index\"(\s+shape=\"rect\")?>Goto</a>
Index</p>|i) {
- next;
+ return 1;
}
+ return 0;
}
sub collect_headlines {
@@ -314,10 +315,12 @@
print "$prefix <h1 id=\"index\">Document
Index</h1>\n";
print "$prefix <!-- This index";
print " was generated by ";
- my $cmd_line = $cgi->escapeHTML("@cmd_line");
+ my $cmd_line = "@cmd_line";
# See
http://www.xml.com/axml/target.html#sec-comments
- $cmd_line =~ s{-}{&\#45;}g;
- print $cmd_line . " -->\n$prefix <ul>\n";
+ my @cmd_line_escaped = map {
+ sprintf("'$_'", $_);
+ } @cmd_line;
+ print "@cmd_line_escaped" . " -->\n$prefix
<ul>\n";
print "$prefix <li><a href=\"#\">Goto</a>
Top</li>\n";
if ($sort) {
@index = sort byText @index;
@@ -350,7 +353,7 @@
use vars qw($VERSION @EXPORT @EXPORT_OK %EXPORT_TAGS);
# $VERSION = 1.00;
# if using RCS/CVS, this may be preferred
- $VERSION = do { my @r = (q$Revision: 1.55 $ =~ /\d+/g); sprintf
"%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
+ $VERSION = do { my @r = (q$Revision: 1.56 $ =~ /\d+/g); sprintf
"%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
@EXPORT = qw();
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@@ -386,7 +389,7 @@
use vars qw($VERSION @EXPORT @EXPORT_OK %EXPORT_TAGS);
# $VERSION = 1.00;
# if using RCS/CVS, this may be preferred
- $VERSION = do { my @r = (q$Revision: 1.55 $ =~ /\d+/g); sprintf
"%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
+ $VERSION = do { my @r = (q$Revision: 1.56 $ =~ /\d+/g); sprintf
"%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
@EXPORT = qw();
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@@ -549,7 +552,7 @@
use vars qw($VERSION @EXPORT @EXPORT_OK %EXPORT_TAGS);
# $VERSION = 1.00;
# if using RCS/CVS, this may be preferred
- $VERSION = do { my @r = (q$Revision: 1.55 $ =~ /\d+/g); sprintf
"%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
+ $VERSION = do { my @r = (q$Revision: 1.56 $ =~ /\d+/g); sprintf
"%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
@EXPORT = qw();
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@@ -645,7 +648,9 @@
# APA: If a Markup Language indexer has been instantiated,
# then use it!
if (ref $indexer and $indexer->isa('ML::Indexer')) {
- $indexer->skip_index();
+ if ($indexer->skip_index() == 1) {
+ next;
+ }
if ($opt_headline) {
$indexer->collect_headlines();
}