--- trunk/make_config.pl 2003/08/04 16:41:14 44 +++ trunk/make_config.pl 2003/11/19 12:07:07 45 @@ -6,15 +6,18 @@ # use strict; +use Getopt::Long; + +my $stripurl; + +my $result = GetOptions ("stripurl=s" => \$stripurl); my $name = shift @ARGV; my $url = shift @ARGV; -#my $stripurl = shift @ARGV; -my $stripurl; my $title = join(" ",@ARGV); if (!$name || !$url) { - print "Usage: $0 name URL [strip from url] [optional title]\n"; + print "Usage: $0 [--stripurl=path] name URL title\n"; exit; } @@ -29,10 +32,10 @@ if ($url =~ m#(http://[^/]+)(/.*)$#) { ($host,$urlpath) = ($1,$2); - if ($stripurl && $urlpath =~ m/^(.*$stripurl)/) { + if ($stripurl && $url =~ m/^(.*$stripurl)/) { $stripurl = $1; } else { - $stripurl = ""; + $stripurl = $host; } } else { print "Can't parse URL $url into host and path!\n"; @@ -54,7 +57,7 @@ # this is a cludge to implement no parent URL feature in swish indexer IndexDir "$baseurl $url" ReplaceRules replace "$baseurl " "" -ReplaceRules replace "${host}${stripurl}" "" +ReplaceRules replace "${stripurl}" "" IndexFile $dir/index/$name @@ -81,7 +84,15 @@ } else { $xml .= "\ttitle=\"$name search\"\n"; } -$xml .= "\turl=\"$stripurl\"\n" if ($stripurl); + +my $xml_title = $title || $url; + +my $xml_url = $url; +$xml_url =~ s/^$host//; +my $xml_urlprefix = $stripurl; +$xml_urlprefix =~ s/^$host//; + +$xml .= "\turl=\"$xml_urlprefix\"\n" if ($stripurl); $xml .= << "EOF"; > @@ -103,8 +114,8 @@ (-) before it, it will exclude documents with this word and plus (+) will do the opposite (e.g. -work +play) -

URI of indexed content: - $url

+

Content indexed: + $xml_title

]]>