perl-docs-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-docs/tmpl/custom/html navbar_local_top search
Date Sun, 24 Mar 2002 17:06:39 GMT
stas        02/03/24 09:06:39

  Modified:    src      style.css
               src/search .swishcgi.conf SwishSpiderConfig.pl search.tt
                        swish.cgi swish.conf
               tmpl/custom/html navbar_local_top search
  Log:
  working on the site search, syncs with the new swish-e
  Submitted by:	Bill Moseley <moseley@hank.org>
  Reviewed by:	stas
  
  Revision  Changes    Path
  1.39      +40 -0     modperl-docs/src/style.css
  
  Index: style.css
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/style.css,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- style.css	5 Mar 2002 05:05:26 -0000	1.38
  +++ style.css	24 Mar 2002 17:06:38 -0000	1.39
  @@ -216,6 +216,46 @@
       font-size: 1.2em;
   }
   
  +
  +/* Search Results */
  +
  +div.searchform {
  +    font-size: 0.8em;
  +}
  +
  +td.searchheader {
  +    background-color: #525a73;
  +    font-family: verdana, arial, helvetica, sans-serif;
  +    color: #ffffff;
  +    font-size: 0.8em;
  +}
  +
  +td.searchtimes {
  +    background-color: #525a73;
  +    font-family: verdana, arial, helvetica, sans-serif;
  +    color: #ffffff;
  +    font-size: 0.6em;
  +}
  +
  +
  +td.searchnav {
  +    background-color: #eeeeee;
  +    font-family: verdana, arial, helvetica, sans-serif;
  +    color: #000000;
  +    font-size: 0.8em;
  +}
  +
  +dd.searchsummary {
  +    font-size: 0.8em;
  +}
  +
  +dd.searchprops {
  +    font-size: 0.6em;
  +    color: green;
  +}
  +
  +
  +
   code { 
       font-family: courier new, courier, monospace;
   }
  
  
  
  1.3       +25 -7     modperl-docs/src/search/.swishcgi.conf
  
  Index: .swishcgi.conf
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/search/.swishcgi.conf,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- .swishcgi.conf	3 Mar 2002 11:27:21 -0000	1.2
  +++ .swishcgi.conf	24 Mar 2002 17:06:38 -0000	1.3
  @@ -1,6 +1,8 @@
   return {
  -    title => 'Search mod_perl Site',
  -    template => {
  +    title           => 'Search mod_perl Site',
  +    prepend_path    => '../',  # search results are shown one level down
  +
  +    template        => {
               package         => 'TemplateToolkit',
               file            => 'search.tt',
               options         => {
  @@ -13,13 +15,29 @@
           #method      => 'popup_menu',
           columns     => 6,
           metaname    => 'section',     # Can't be a metaname used elsewhere!
  -        values      => [qw/about contribute docs download maillist products stats stories
support/],
  +
  +        # These are the words (phrases) used for limiting searches to areas of the document
tree
  +        values      => [qw(
  +            docs
  +            docs/1.0/guide
  +            docs/1.0/faqs
  +            docs/2.0
  +            maillist
  +            stories
  +            support
  +        )],
  +
           labels  => {
  -            about   => 'About mod_perl',
  -            doc     => 'Documentation',
  -            stories => 'Sucess Stories',
  -            support => 'Support',
  +            docs        => 'mod_perl Documentation',
  +            'docs/1.0/guide'    => 'The Guide',
  +            'docs/1.0/faqs'     => 'Faqs',
  +            'docs/2.0'  => '2.0 Docs',
  +            maillist    => 'Mailing Lists',
  +            products    => 'mod_perl Based Software',
  +            stories     => 'Sucess Stories',
  +            support     => 'Support Options',
           },
  +
           description => 'Limit search to these areas: ',
       },
       
  
  
  
  1.6       +32 -14    modperl-docs/src/search/SwishSpiderConfig.pl
  
  Index: SwishSpiderConfig.pl
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/search/SwishSpiderConfig.pl,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SwishSpiderConfig.pl	23 Mar 2002 09:11:33 -0000	1.5
  +++ SwishSpiderConfig.pl	24 Mar 2002 17:06:38 -0000	1.6
  @@ -51,11 +51,10 @@
       @params{ qw/ uri server response content / } = @_;
       $params{found} = 0;
   
  -
       my $tree = HTML::TreeBuilder->new;
       $tree->store_comments(1);
   
  -        $tree->parse( ${$params{content}} );  # Why not allow a scalar ref?
  +    $tree->parse( ${$params{content}} );  # Why not allow a scalar ref?
       $tree->eof;
   
   
  @@ -68,9 +67,17 @@
           for $tree->look_down( '_tag', 'div', 'class', 'index_section' );
   
   
  +    ## If a page doesn't have an "index_section" then it's probably a table of contents
(index.html)
  +    ## so don't index it.
  +    return 0;
  +   
  +
  +
       # Indexed the page in sections, just return
       return 0 if $params{found};
   
  +    
  +
       # No sections found, so index the entire page (probably index.html)
   
       # Stip base_path
  @@ -92,33 +99,44 @@
   
       my $uri = $params->{uri};
   
  -    my $section_name = 'Unknown_Section';
  -    my $name = $section->look_down( '_tag', 'a',
  -                                    sub { defined($_[0]->attr('name')) } );
   
  +    # Grab the section link, and create a new title
  +
  +    my $name = $section->look_down( '_tag', 'a', sub { defined($_[0]->attr('name'))
} );
  +
  +    my @a_content = ('Unknown title');
  +    
       if ( $name ) {
  -        $section_name = $name->attr('name');
  +        my $section_name = $name->attr('name');
           $uri->fragment( $section_name );
  +
  +        $section_name =~ tr/_//d;
  +
  +        @a_content = $name->content_list ? $name->content_list : ( $section_name
);
       }
   
  -    my $text_title = $section_name;
  -    $text_title =~ tr/_/ /s;
   
  +    # Modify or create the title
  +    
       my $title = $head->look_down('_tag', 'title');
   
       if ( $title ) {
  -        $title->push_content(": $text_title");
  +        $title->push_content( ': ', @a_content );
       } else {
           my $title = HTML::Element->new('title');
  -        $title->push_content(": $text_title");
  +        $title->push_content(  @a_content );
           $head->push_content( $title );
       }
   
  +
  +
  +
       # Extract out part of the path to use for limiting searches to parts of the document
tree.
   
  +
       if ( $uri =~ m!$base_path/(.+)$! ) {
           my $path = $1;
  -        $path =~ s{[^/]$}{};  # remove file name, if one
  +        $path =~ s{/?[^/]+$}{};  # remove file name, if one
           my $meta = HTML::Element->new('meta', name=> 'section', content => $path);
           $head->push_content( $meta );
       }
  @@ -132,12 +150,12 @@
       $doc->push_content( $head, $body );
   
       # If we want to stip the base_path
  -    #my $url = $uri->as_string;
  -    #$url =~ s/$base_path//;
  +    my $url = $uri->as_string;
  +    $url =~ s[$base_path/][];
   
       my $new_content = $doc->as_HTML(undef,"\t");
       output_content( $params->{server}, \$new_content,
  -                    $uri, $params->{response} );
  +                    $url, $params->{response} );
   
       $uri->fragment(undef);
   
  
  
  
  1.6       +15 -17    modperl-docs/src/search/search.tt
  
  Index: search.tt
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/search/search.tt,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- search.tt	22 Mar 2002 07:28:13 -0000	1.5
  +++ search.tt	24 Mar 2002 17:06:38 -0000	1.6
  @@ -3,7 +3,8 @@
   -%]
   [% WRAPPER searchresults.html %]
   [%
  -    PROCESS swish_header;
  +    # Title takes up space for no reason
  +    # PROCESS swish_header;
   
       title = PROCESS title;
   
  @@ -61,6 +62,7 @@
   
   [% BLOCK search_form %]
   
  +    <div class="searchform">
       [% CGI.start_form( '-action' => CGI.script_name) %]
           [% CGI.textfield( {
               name    => 'query',
  @@ -75,6 +77,7 @@
           [% search.get_limit_select %]
           
       [% CGI.end_form.join('') %]
  +    </div>
   
   [% END %]
   
  @@ -84,25 +87,20 @@
       [% search.stopwords_removed %]
       <table cellpadding=0 cellspacing=0 border=0 width="100%">
           <tr>
  -            <td height=20 bgcolor="#FF9999">
  -                <font size="-1" face="Geneva, Arial, Helvetica, San-Serif">
  +            <td height=20 class="searchheader">
                   &nbsp;Results for <b>[% search.query_simple | html %]</b>
                   &nbsp; [% search.navigation('from') %] to [% search.navigation('to')
%] of [% search.navigation('hits') %] results.
  -                </font>
               </td>
  -            <td align=right bgcolor="#FF9999">
  -                <font size="-2" face="Geneva, Arial, Helvetica, San-Serif">
  -                Run time: [% search.navigation('run_time') %] |
  +            <td align=right class="searchtimes">
                   Search time: [% search.navigation('search_time') %] &nbsp; &nbsp;
  -                </font>
               </td>
           </tr>
   
           [% IF search.navigation('pages') %]
   
           <tr>
  -            <td colspan=2 bgcolor="#EEEEEE">
  -                <font size="-1" face="Geneva, Arial, Helvetica, San-Serif">&nbsp;Page:</font>
  +            <td colspan=2 class="searchnav">
  +                &nbsp;Page:
                   [% search.navigation('pages') %]
   
                   [% IF search.navigation('prev_count') %]
  @@ -136,15 +134,15 @@
                   <small>-- rank: <b>[% item.swishrank %]</b></small>
               </dt>
   
  -            <dd>
  +            <dd class="searchsummary">
                   [% item.swishdescription %]
  -                <br>
  -                <small>
  -                    [% item.swishdocpath %]
  -                    - [% item.swishdocsize %] bytes
  -                    - [% item.swishlastmodified %]
  -                </small>
               </dd>
  +            <dd class="searchprops">
  +                [% item.swishdocpath %]<br>
  +                [% item.swishdocsize %] bytes
  +                [% item.swishlastmodified %]
  +            </dd>
  +            
           </dl>
       [% END %]
   
  
  
  
  1.6       +4 -4      modperl-docs/src/search/swish.cgi
  
  Index: swish.cgi
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/search/swish.cgi,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- swish.cgi	22 Mar 2002 10:52:16 -0000	1.5
  +++ swish.cgi	24 Mar 2002 17:06:38 -0000	1.6
  @@ -18,7 +18,7 @@
   #
   #    To display documentation for this program type "perldoc swish.cgi"
   #
  -#    swish.cgi $Revision: 1.5 $ Copyright (C) 2001 Bill Moseley swishscript@hank.org
  +#    swish.cgi $Revision: 1.6 $ Copyright (C) 2001 Bill Moseley swishscript@hank.org
   #    Example CGI program for searching with SWISH-E
   #
   #    This example program will only run under an OS that supports fork().
  @@ -37,7 +37,7 @@
   #
   #    The above lines must remain at the top of this program
   #
  -#    $Id: swish.cgi,v 1.5 2002/03/22 10:52:16 stas Exp $
  +#    $Id: swish.cgi,v 1.6 2002/03/24 17:06:38 stas Exp $
   #
   ####################################################################################
   
  @@ -990,7 +990,7 @@
       # Should look into doing:
       # $query = "( $query ) AND " . $limits->{metaname} . '=(' . join( ' OR ', @limits
) . ')';
       if ( @limits && ref $limits eq 'HASH' && $limits->{metaname} ) {
  -        $query .= ' and ' . $limits->{metaname} . '=(' . join( ' or ', @limits ) . ')';
  +        $query .= ' and ' . $limits->{metaname} . '=(' . join( ' or ', map { qq["$_"]}
@limits ) . ')';
       }
   
   
  @@ -2516,7 +2516,7 @@
   
   =head1 LICENSE
   
  -swish.cgi $Revision: 1.5 $ Copyright (C) 2001 Bill Moseley search@hank.org
  +swish.cgi $Revision: 1.6 $ Copyright (C) 2001 Bill Moseley search@hank.org
   Example CGI program for searching with SWISH-E
   
   
  
  
  
  1.6       +10 -11    modperl-docs/src/search/swish.conf
  
  Index: swish.conf
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/search/swish.conf,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- swish.conf	23 Mar 2002 09:11:33 -0000	1.5
  +++ swish.conf	24 Mar 2002 17:06:38 -0000	1.6
  @@ -1,20 +1,19 @@
  +# Use an external program "spider.pl" to generate input for swish
   IndexDir ./spider.pl
  +
  +# Use the libxml2 parser, and save up to 100,000 chars 
   DefaultContents HTML2
   StoreDescription HTML2 <body> 100000
  -MetaNames swishtitle swishdocpath section
  -
  -# This is to make the URLs shorter in the display.
  -ReplaceRules remove http://perl.apache.org
   
  -# For example, on my test setup I might do something like:
  -# Need ".." since search is on level down
  -
  -ReplaceRules replace http://mardy:40994/dst_html ..
   
  +# Allow limiting searches by these metanames
  +MetaNames swishtitle swishdocpath section
   
  +# And don't index any text from other <meta> tags
   UndefinedMetaTags ignore
   
  -#BuzzWords in highlighting -- 
  -#How about counting highlighted terms individually in the highlight module
  -#so every term is highlighted at least once, with a total of say five.
  +# Add in the _ and : in the middle of a word
  +WordCharacters _:0123456789abcdefghijklmnopqrstuvwxyz
  +IgnoreFirstChar _:
  +IgnoreLastChar _:
   
  
  
  
  1.11      +0 -1      modperl-docs/tmpl/custom/html/navbar_local_top
  
  Index: navbar_local_top
  ===================================================================
  RCS file: /home/cvs/modperl-docs/tmpl/custom/html/navbar_local_top,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- navbar_local_top	22 Mar 2002 02:02:16 -0000	1.10
  +++ navbar_local_top	24 Mar 2002 17:06:39 -0000	1.11
  @@ -19,5 +19,4 @@
           </td>
       </tr>
   </table>
  -</form>
   <!--this line break must be here for ns4-->
  
  
  
  1.12      +2 -1      modperl-docs/tmpl/custom/html/search
  
  Index: search
  ===================================================================
  RCS file: /home/cvs/modperl-docs/tmpl/custom/html/search,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- search	23 Mar 2002 09:11:33 -0000	1.11
  +++ search	24 Mar 2002 17:06:39 -0000	1.12
  @@ -18,7 +18,7 @@
           <td class="menu-border" width="1"><br class="smallbr"></td>
           <td class="search" width="2" align="center">
               <input type="submit" name="submit" value="Search" class="submit-but">
  -            <input type="hidden" name="sbm" value="&quot;[% doc.dir.path_from_base
%]&quot;">
  +            <input type="hidden" name="sbm" value="[% doc.dir.path_from_base %]">
            </td>
           <td class="menu-border" width="1"><br class="smallbr"></td>
       </tr>
  @@ -26,3 +26,4 @@
           <td class="menu-border" colspan="5" height="1"><br class="smallbr"></td>
       </tr>
   </table>
  +</form>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org


Mime
View raw message