/[swish]/trunk/make_config.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/make_config.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 44 by dpavlin, Mon Aug 4 16:41:14 2003 UTC revision 45 by dpavlin, Wed Nov 19 12:07:07 2003 UTC
# Line 6  Line 6 
6  #  #
7    
8  use strict;  use strict;
9    use Getopt::Long;
10    
11    my $stripurl;
12    
13    my $result = GetOptions ("stripurl=s" => \$stripurl);
14    
15  my $name = shift @ARGV;  my $name = shift @ARGV;
16  my $url = shift @ARGV;  my $url = shift @ARGV;
 #my $stripurl = shift @ARGV;  
 my $stripurl;  
17  my $title = join(" ",@ARGV);  my $title = join(" ",@ARGV);
18    
19  if (!$name || !$url) {  if (!$name || !$url) {
20          print "Usage: $0 name URL [strip from url] [optional title]\n";          print "Usage: $0 [--stripurl=path] name URL title\n";
21          exit;          exit;
22  }  }
23    
# Line 29  my ($host,$urlpath); Line 32  my ($host,$urlpath);
32    
33  if ($url =~ m#(http://[^/]+)(/.*)$#) {  if ($url =~ m#(http://[^/]+)(/.*)$#) {
34          ($host,$urlpath) = ($1,$2);          ($host,$urlpath) = ($1,$2);
35          if ($stripurl && $urlpath =~ m/^(.*$stripurl)/) {          if ($stripurl && $url =~ m/^(.*$stripurl)/) {
36                  $stripurl = $1;                  $stripurl = $1;
37          } else {          } else {
38                  $stripurl = "";                  $stripurl = $host;
39          }          }
40  } else {  } else {
41          print "Can't parse URL $url into host and path!\n";          print "Can't parse URL $url into host and path!\n";
# Line 54  IncludeConfigFile $dir/common.config Line 57  IncludeConfigFile $dir/common.config
57  # this is a cludge to implement no parent URL feature in swish indexer  # this is a cludge to implement no parent URL feature in swish indexer
58  IndexDir "$baseurl $url"  IndexDir "$baseurl $url"
59  ReplaceRules replace "$baseurl " ""  ReplaceRules replace "$baseurl " ""
60  ReplaceRules replace "${host}${stripurl}" ""  ReplaceRules replace "${stripurl}" ""
61    
62  IndexFile $dir/index/$name  IndexFile $dir/index/$name
63    
# Line 81  if ($title) { Line 84  if ($title) {
84  } else {  } else {
85          $xml .= "\ttitle=\"$name search\"\n";          $xml .= "\ttitle=\"$name search\"\n";
86  }  }
87  $xml .= "\turl=\"$stripurl\"\n" if ($stripurl);  
88    my $xml_title = $title || $url;
89    
90    my $xml_url = $url;
91    $xml_url =~ s/^$host//;
92    my $xml_urlprefix = $stripurl;
93    $xml_urlprefix =~ s/^$host//;
94    
95    $xml .= "\turl=\"$xml_urlprefix\"\n" if ($stripurl);
96  $xml .= << "EOF";  $xml .= << "EOF";
97          >          >
98          <labels>          <labels>
# Line 103  $xml .= << "EOF"; Line 114  $xml .= << "EOF";
114                  (<tt>-</tt>) before it, it will exclude documents with this                  (<tt>-</tt>) before it, it will exclude documents with this
115                  word and plus (<tt>+</tt>) will do the opposite                  word and plus (<tt>+</tt>) will do the opposite
116                  (e.g. <tt>-work +play</tt>)                  (e.g. <tt>-work +play</tt>)
117                  <p><small>URI of indexed content:                  <p><small>Content indexed:
118                  <a href="$url">$url</small></p>                  <a href="$xml_url">$xml_title</small></p>
119                  ]]></footer>                  ]]></footer>
120          </text>          </text>
121          <!-- additional data to show summary -->          <!-- additional data to show summary -->

Legend:
Removed from v.44  
changed lines
  Added in v.45

  ViewVC Help
Powered by ViewVC 1.1.26