You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs-cvs@perl.apache.org by mo...@apache.org on 2002/05/24 00:42:02 UTC

cvs commit: modperl-docs/src/search make.pl .swishcgi.conf search_options

moseley     02/05/23 15:42:02

  Modified:    src/search .swishcgi.conf
  Added:       src/search make.pl
  Removed:     src/search search_options
  Log:
  Here's the unified version of the search options that Stas requested.
  
  make.pl must be run befor generating any pages.
  I'm not clear how (or if) Docset can do that automatically.
  
  The code see ok, Stas?
  
  Revision  Changes    Path
  1.11      +6 -102    modperl-docs/src/search/.swishcgi.conf
  
  Index: .swishcgi.conf
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/search/.swishcgi.conf,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- .swishcgi.conf	15 May 2002 04:22:13 -0000	1.10
  +++ .swishcgi.conf	23 May 2002 22:42:02 -0000	1.11
  @@ -1,88 +1,11 @@
   
  -
  -# Display swish times in GMT
  -
  -$ENV{TZ} = 'UTC';
  +use Storable;
  +my $CHECKBOX_DATA = 'checkboxes.storable';
   
   
  -# Stas added tree display - Apr 15, 2002
  -# syntax (amount of spaces doesn't matter):
  -# indent path title
  -#
  -
  -
  -my $items = <<ITEMS;
  -    0 outstanding Technologie Extraordinaire
  -    0 download    Download
  -    0 docs        Documentation
  -    1   docs/1.0 mod_perl 1.0 Docs
  -    2     docs/1.0/guide Guide
  -    2     docs/1.0/win32 Win32
  -    2     docs/1.0/api   API
  -    1   docs/2.0 mod_perl 2.0 Docs
  -    2     docs/2.0/user  User
  -    2     docs/2.0/devel Developer
  -    2     docs/2.0/api   API
  -    1   docs/general      General Docs
  -    1   docs/tutorials    Tutorials
  -    1   docs/offsite      OffSite Docs
  -    0 help       Getting Help
  -    0 products   Products
  -    0 contribute Contribute
  -ITEMS
  -
  -my @items_flat = split /\n/, $items, ;
  -
  -my @items = ();
  -my $parent;
  -my $cur_indent = 0;
  -for my $item (@items_flat) {
  -    $item = '' unless defined $item;
  -    my ($indent, $path, $title);
  -    if ($item =~ m|^\s*(\d+)\s+(\S+)\s+(.*)$|) {
  -        ($indent, $path, $title) = ($1, $2, $3)
  -    }
  -    else {
  -        warn "couldn't parse '$item'";
  -        next;
  -    }
  -
  -    my $node = {
  -        label  => $title,
  -        value  => $path,
  -        parent => $parent,
  -    };
  -
  -    my $diff = $indent - $cur_indent;
  -    #print "$indent, $cur_indent, $path, $title\n";
  -    if ($diff < 1 ) {
  -        for (0..abs($diff)) {
  -            $parent = $parent->{parent};
  -            $cur_indent--;
  -        }
  -    }
  -
  -    if ($indent == 0) {
  -        push @items, $node;
  -        $parent = $items[-1];
  -        $cur_indent = 0;
  -        next;
  -    }
  -
  -    if ($diff > 1) {
  -        $cur_indent++;
  -        $parent = @{ $parent->{subs} }[-1];
  -        push @{ $parent->{subs} }, $node;
  -    }
  -    else { # $indent - $cur_indent = 1
  -        push @{ $parent->{subs} }, $node;
  -    }
  -
  -}
  -
  -#use Data::Dumper;
  -#print Dumper \@items;
   
  +# Display swish times in GMT
  +$ENV{TZ} = 'UTC';
   
   return {
       title           => 'Search mod_perl Site',
  @@ -108,30 +31,11 @@
           columns     => 6,
           metaname    => 'section',     # Can't be a metaname used elsewhere!
   
  -        # These are the words (phrases) used for limiting searches to areas of the document tree
  -        values      => [qw(
  -            docs
  -            docs/1.0/guide
  -            docs/2.0
  -            maillist
  -            stories
  -            support
  -        )],
  -
  -        labels  => {
  -            docs        => 'mod_perl Documentation',
  -            'docs/1.0/guide'    => 'The Guide',
  -            '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: ',
   
  -        # This is the tree structure of selects
  -        items       => \@items,
  +        # This is the tree structure of selects, saved with Storable
  +        items       => retrieve( $CHECKBOX_DATA ),
       },
       
   };
  
  
  
  1.1                  modperl-docs/src/search/make.pl
  
  Index: make.pl
  ===================================================================
  #!/usr/local/bin/perl -w
  use strict;
  use Storable;
  
  # This must match up with .swishcgi.conf setting
  my $CHECKBOX_DATA = 'checkboxes.storable';
  
  # This is used for all pages -- it's the array and has for the sidebar search
  my $SEARCH_OPTIONS = 'search_options';
  
  
  # Stas added tree display - Apr 15, 2002
  # Rewritten May 23, 2000 at Stas' request to centralize the input data in one place
  # syntax (amount of spaces doesn't matter):
  # indent, path, title, optional short title (for drop down list)
  #
  
  
  my $items = <<ITEMS;
      0, outstanding, Technologie Extraordinaire, Stories
      0, download,    Download, Download
      0, docs,        Documentation, All Docs
      1,   docs/1.0, mod_perl 1.0 Docs, 1.0 Docs
      2,     docs/1.0/guide, Guide,
      2,     docs/1.0/win32, Win32
      2,     docs/1.0/api,   API
      1,   docs/2.0, mod_perl 2.0 Docs, 2.0 Docs
      2,     docs/2.0/user,  User
      2,     docs/2.0/devel, Developer
      2,     docs/2.0/api,   API
      1,   docs/general,      General Docs
      1,   docs/tutorials,    Tutorials
      1,   docs/offsite,      OffSite Docs
      0, help,       Getting Help
      0, maillist,  Mailing Lists
      0, products,   Products
      0, contribute, Contribute
  ITEMS
  
  
  
      my @items_flat = map {
               s/^\s+//;
               s/\s+$//;
               my %h;
               @h{qw/indent value label short/} = split m!\s*,\s*!;
  
               $h{short} ||= ( $h{label} || 'missing description' );
  
               \%h
          } split /\n/, $items;
  
  
      my $array_values = join "\n", map { ' ' x (( $_->{indent}+2 ) * 4) . qq["$_->{value}"] }  @items_flat;
      my $hash_values  = join "\n", map {
          my $dots = '..' x  $_->{indent};
          my $spaces = ' ' x (( $_->{indent}+2 ) * 4);
          qq[$spaces"$_->{value}" => "$dots$_->{short}" ]
      } @items_flat;
          
      my $check_box_array = build_array( \@items_flat );
  
  #use Data::Dumper;                
  #print Dumper $check_box_array;
  
      store( $check_box_array, $CHECKBOX_DATA );  # store for swish.cgi
  
      # Now write out the search_options
      open FH, ">$SEARCH_OPTIONS" or die "Failed to open '$SEARCH_OPTIONS': $!";
  
      my $now = scalar localtime;
      
      print FH <<EOF;
  [%-
  #--------------------------------------------------------------------------------------
  # *** Automatically generated file.  Do not edit.  Modify $0 instead! ***
  #    File: '$SEARCH_OPTIONS'
  #     Use: generating the sidebar select options for searching
  # Created: $now
  #--------------------------------------------------------------------------------------
  
      search_areas = [
          ""
  $array_values
      ]
  
      search_labels = {
          ""          => 'Whole Site'
  $hash_values        
      }
  -%]
  EOF
  
      close FH || warn "Failed to close '$SEARCH_OPTIONS': $!";
  
      warn "Built search data structures\n";
      
  
  
  #==============================================================================
  # Subroutine that builds the data structure expected by template toolkit
  # TT uses values .value, .label, and .subs.  See search.tt for example
  #
  #
  #
  sub build_array {
      my ( $items ) = @_;
  
      my $indent = $items->[0]{indent};
  
      my @array;
  
      while ( @$items ) {  # more left in array?
  
          if ( $items->[0]{indent} == $indent ) {      # this is the level we are processing
              push @array, shift @$items;
  
          } elsif ( $items->[0]{indent} < $indent ) {  # all done with this level, so just return
              return \@array;
  
          } else {                                        # found an indented section
              $array[-1]{subs} = build_array( $items );
          }
      }
  
      return \@array;
  }
  
  
  
  

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


Re: cvs commit: modperl-docs/src/search make.pl .swishcgi.conf search_options

Posted by Per Einar Ellefsen <pe...@skynet.be>.
At 15:46 29.05.2002, Bill Moseley wrote:
>At 07:52 PM 05/29/02 +0800, Stas Bekman wrote:
> >> I guess Bill's point was that it's a CGI-executable dir, so we don't
> >> want any confusion about what is CGI and what not.
> >
> >that makes sense. In any case I've fixed that now.
>
>Is it a CGI-executable dir?  I'm using:
>
>deny from all
><files swish.cgi>
>    allow from all
>#   Options +ExecCGI
></files>
>
>But, of course, that depends on the server, and the server's config (e.g.
>if Options are allowed, etc.).

Yes, I knew that, but just meant that some files are *.pl and supposed to 
be executed by the server, while some only at build-time...

>Stas, I guess I need to add the files built by make.pl to CVS.  Seems
>awkward to me since I'm used to keeping only source in CVS, but since
>there's no "Makefile" type of struture to build dependencies I suppose they
>need to be in CVS.  In the pervious incarnation of Docset (pod2hpp?) I use
>a Makefile to build all dependencies first, and the Makefile then runs
>bin/build.

It'll be slightly easier this way.. As Stas said, we won't run make.pl too 
often anyway, so everything'll be ok.


-- 
Per Einar Ellefsen
per.einar@skynet.be



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


Re: cvs commit: modperl-docs/src/search make.pl .swishcgi.conf search_options

Posted by Stas Bekman <st...@stason.org>.
Bill Moseley wrote:
> At 07:52 PM 05/29/02 +0800, Stas Bekman wrote:
> 
>>>I guess Bill's point was that it's a CGI-executable dir, so we don't 
>>>want any confusion about what is CGI and what not.
>>
>>that makes sense. In any case I've fixed that now.
> 
> 
> Is it a CGI-executable dir?  I'm using:
> 
> deny from all
> <files swish.cgi>
>    allow from all
> #   Options +ExecCGI
> </files>
> 
> But, of course, that depends on the server, and the server's config (e.g.
> if Options are allowed, etc.).

In any case it's not copied now.

> Stas, I guess I need to add the files built by make.pl to CVS.  

I've done this already.

> Seems awkward to me since I'm used to keeping only source in CVS, but since
> there's no "Makefile" type of struture to build dependencies I suppose they
> need to be in CVS.  In the pervious incarnation of Docset (pod2hpp?) I use
> a Makefile to build all dependencies first, and the Makefile then runs
> bin/build.

I guess we can add this feature to DocSet. I'm not planning to do that 
any time soon, as I've too many other things to do. If anybody 
implements it, that would be cool. I'll add it to the TODO list.

As of this moment we just commit autogenerated things.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


Re: cvs commit: modperl-docs/src/search make.pl .swishcgi.conf search_options

Posted by Bill Moseley <mo...@hank.org>.
At 07:52 PM 05/29/02 +0800, Stas Bekman wrote:
>> I guess Bill's point was that it's a CGI-executable dir, so we don't 
>> want any confusion about what is CGI and what not.
>
>that makes sense. In any case I've fixed that now.

Is it a CGI-executable dir?  I'm using:

deny from all
<files swish.cgi>
   allow from all
#   Options +ExecCGI
</files>

But, of course, that depends on the server, and the server's config (e.g.
if Options are allowed, etc.).

Stas, I guess I need to add the files built by make.pl to CVS.  Seems
awkward to me since I'm used to keeping only source in CVS, but since
there's no "Makefile" type of struture to build dependencies I suppose they
need to be in CVS.  In the pervious incarnation of Docset (pod2hpp?) I use
a Makefile to build all dependencies first, and the Makefile then runs
bin/build.


-- 
Bill Moseley
mailto:moseley@hank.org

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


Re: cvs commit: modperl-docs/src/search make.pl .swishcgi.conf search_options

Posted by Stas Bekman <st...@stason.org>.
Per Einar Ellefsen wrote:

>>>> How do I tell Docset not to copy make.pl to dst_html?
>>>
>>>
>>> In src/config.cfg we say to copy the whole search/ dir.
>>> Change this part in src/config.cfg (adding the make.pl line)
>>>     copy_skip => [
>>>         '(?:^|\/)CVS(?:\/|$)', # skip cvs control files
>>>         '#|~',                 # skip emacs backup files
>>>         'make\.pl',
>>>     ],
>>> I tested it, works correctly.
>>
>>
>> I guess it doesn't matter if it gets copied. Or do you feel strongly 
>> about not doing that?
> 
> 
> I guess Bill's point was that it's a CGI-executable dir, so we don't 
> want any confusion about what is CGI and what not.

that makes sense. In any case I've fixed that now.
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


Re: cvs commit: modperl-docs/src/search make.pl .swishcgi.conf search_options

Posted by Per Einar Ellefsen <pe...@skynet.be>.
At 09:17 29.05.2002, Stas Bekman wrote:
>Thanks Bill for this change, I'll adjust the rest of the things, including 
>README.
>
>>> >>   make.pl must be run befor generating any pages.
>>> >>   I'm not clear how (or if) Docset can do that automatically.
>>> >
>>> >Could you please add the files generated by make.pl to CVS? We do that for
>>> >the other files, because if not each person who wants to build the 
>>> docs has
>>> >to run the individual make.pl files.
>>>
>>>Oh, sorry.  I misunderstood what make.pl was for.  I thought it would be
>>>part of the bin/build process.  I guess it's not a Makefile.
>>
>>Hmm, I wonder if DocSet should maybe start supporting this as a feature.. 
>>Or maybe not. We'll manage as is.
>
>No it shouldn't. You run make.pl infrequently and shouldn't be run every 
>time bin/build is run. If you want to run it from DocSet it should be 
>rewritten to support source modification control, so it'll be executed 
>only when things change. If you look at the existing make.pl files, they 
>are all very different, so it's not that simple to define dependency rules.
>
>Later if we feel a burning need for this we can add this feature.
>
>>>How do I tell Docset not to copy make.pl to dst_html?
>>
>>In src/config.cfg we say to copy the whole search/ dir.
>>Change this part in src/config.cfg (adding the make.pl line)
>>     copy_skip => [
>>         '(?:^|\/)CVS(?:\/|$)', # skip cvs control files
>>         '#|~',                 # skip emacs backup files
>>         'make\.pl',
>>     ],
>>I tested it, works correctly.
>
>I guess it doesn't matter if it gets copied. Or do you feel strongly about 
>not doing that?

I guess Bill's point was that it's a CGI-executable dir, so we don't want 
any confusion about what is CGI and what not.


-- 
Per Einar Ellefsen
per.einar@skynet.be



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


Re: cvs commit: modperl-docs/src/search make.pl .swishcgi.conf search_options

Posted by Stas Bekman <st...@stason.org>.
Thanks Bill for this change, I'll adjust the rest of the things, 
including README.

>> >>   make.pl must be run befor generating any pages.
>> >>   I'm not clear how (or if) Docset can do that automatically.
>> >
>> >Could you please add the files generated by make.pl to CVS? We do 
>> that for
>> >the other files, because if not each person who wants to build the 
>> docs has
>> >to run the individual make.pl files.
>>
>> Oh, sorry.  I misunderstood what make.pl was for.  I thought it would be
>> part of the bin/build process.  I guess it's not a Makefile.
> 
> 
> Hmm, I wonder if DocSet should maybe start supporting this as a 
> feature.. Or maybe not. We'll manage as is.

No it shouldn't. You run make.pl infrequently and shouldn't be run every 
time bin/build is run. If you want to run it from DocSet it should be 
rewritten to support source modification control, so it'll be executed 
only when things change. If you look at the existing make.pl files, they 
are all very different, so it's not that simple to define dependency rules.

Later if we feel a burning need for this we can add this feature.

>> How do I tell Docset not to copy make.pl to dst_html?
> 
> 
> In src/config.cfg we say to copy the whole search/ dir.
> 
> Change this part in src/config.cfg (adding the make.pl line)
> 
>     copy_skip => [
>         '(?:^|\/)CVS(?:\/|$)', # skip cvs control files
>         '#|~',                 # skip emacs backup files
>         'make\.pl',
>     ],
> 
> I tested it, works correctly.

I guess it doesn't matter if it gets copied. Or do you feel strongly 
about not doing that?

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


Re: cvs commit: modperl-docs/src/search make.pl .swishcgi.conf search_options

Posted by Per Einar Ellefsen <pe...@skynet.be>.
At 18:39 24.05.2002, Bill Moseley wrote:
>At 06:29 PM 05/24/02 +0200, Per Einar Ellefsen wrote:
> >At 00:42 24.05.2002, moseley@apache.org wrote:
> >>
> >>   make.pl must be run befor generating any pages.
> >>   I'm not clear how (or if) Docset can do that automatically.
> >
> >Could you please add the files generated by make.pl to CVS? We do that for
> >the other files, because if not each person who wants to build the docs has
> >to run the individual make.pl files.
>
>Oh, sorry.  I misunderstood what make.pl was for.  I thought it would be
>part of the bin/build process.  I guess it's not a Makefile.

Hmm, I wonder if DocSet should maybe start supporting this as a feature.. 
Or maybe not. We'll manage as is.

>How do I tell Docset not to copy make.pl to dst_html?

In src/config.cfg we say to copy the whole search/ dir.

Change this part in src/config.cfg (adding the make.pl line)

     copy_skip => [
         '(?:^|\/)CVS(?:\/|$)', # skip cvs control files
         '#|~',                 # skip emacs backup files
         'make\.pl',
     ],

I tested it, works correctly.


-- 
Per Einar Ellefsen
per.einar@skynet.be



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


Re: cvs commit: modperl-docs/src/search make.pl .swishcgi.conf search_options

Posted by Bill Moseley <mo...@hank.org>.
At 06:29 PM 05/24/02 +0200, Per Einar Ellefsen wrote:
>At 00:42 24.05.2002, moseley@apache.org wrote:
>>
>>   make.pl must be run befor generating any pages.
>>   I'm not clear how (or if) Docset can do that automatically.
>
>Could you please add the files generated by make.pl to CVS? We do that for 
>the other files, because if not each person who wants to build the docs has 
>to run the individual make.pl files.

Oh, sorry.  I misunderstood what make.pl was for.  I thought it would be
part of the bin/build process.  I guess it's not a Makefile.

How do I tell Docset not to copy make.pl to dst_html?


-- 
Bill Moseley
mailto:moseley@hank.org

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


Re: cvs commit: modperl-docs/src/search make.pl .swishcgi.conf search_options

Posted by Per Einar Ellefsen <pe...@skynet.be>.
At 00:42 24.05.2002, moseley@apache.org wrote:
>
>   make.pl must be run befor generating any pages.
>   I'm not clear how (or if) Docset can do that automatically.

Could you please add the files generated by make.pl to CVS? We do that for 
the other files, because if not each person who wants to build the docs has 
to run the individual make.pl files.


-- 
Per Einar Ellefsen
per.einar@skynet.be



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