stas 02/04/13 08:44:20 Modified: lib/DocSet Util.pm lib/DocSet/Doc Common.pm lib/DocSet/Source POD.pm Log: DocSet sync: - add a cool feature where the titles are linked their own entries in the TOC, so one can easily move back and forward between big sections of the document. - change the timestamp to use local(gmtime) instead of ambiguous mm/dd/yy - move to use pre-bar css class for the virtual bar in <pre></pre> sects (the user has to define this class). - replaced call to `which` with a portable which function in DocSet::Util (taken from Apache::Build in modperl-2.0 and made to use the PATHEXT env variable on WinNT: I can re-submit this one into the modperl-2.0 tree if you think that'll be useful, it finds the specified file terminated by .exe, .bat, etc.. [Per Einar Ellefsen <[EMAIL PROTECTED]>] - use perl %ENV instead of `env` to set PERL5LIB whenh calling docset_build. [Per Einar Ellefsen <[EMAIL PROTECTED]>] - had to replace all regexes that used a directory/file path, and use quotemeta() there, because the backslahes created illegal escape sequences. [Per Einar Ellefsen <[EMAIL PROTECTED]>] Revision Changes Path 1.9 +25 -9 modperl-docs/lib/DocSet/Util.pm Index: Util.pm =================================================================== RCS file: /home/cvs/modperl-docs/lib/DocSet/Util.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Util.pm 3 Apr 2002 11:47:56 -0000 1.8 +++ Util.pm 13 Apr 2002 15:44:20 -0000 1.9 @@ -132,7 +132,7 @@ sub get_timestamp { my ($mon,$day,$year) = (localtime ( time ) )[4,3,5]; - sprintf "%02d/%02d/%04d", ++$mon, $day, 1900+$year; + return scalar gmtime() . ' GMT'; } my %require_seen = (); @@ -274,15 +274,14 @@ return [EMAIL PROTECTED]; } -# which($short_exec_name) -# Portable 'which' implementation. -# -# Parts borrowed from modperl-2.0/lib/Apache/Build.pm and modified to -# take into account Win32 PATHEXT -######################## my @path_ext = (''); -if (IS_WIN32 and $ENV{PATHEXT}) { - push @path_ext, split ';', $ENV{PATHEXT}; +if (IS_WIN32) { + if ($ENV{PATHEXT}) { + push @path_ext, split ';', $ENV{PATHEXT}; + } + else { + push @path_ext, map { ".$_" } qw(com exe bat); # Win9X + } } sub which { for my $base (map { catfile $_, $_[0] } File::Spec->path()) { @@ -352,6 +351,7 @@ confess($string); note($string); + my $exec_path = which('perldoc'); =head1 DESCRIPTION @@ -393,6 +393,22 @@ any C</> are escaped. Be careful with using quotemeta() for this, since you don't want to espace special regex char, e.g. C<^>, C<$>, etc. + +=item * which + + my $exec_path = which('perldoc'); + +a portable function to search for executables on the system. + +Accepts a single argument which is the name of the executable to +search for. Returns the full path to the executable if found, an empty +string otherwise. + +Parts of the implementation are borrowed from +I<modperl-2.0/lib/Apache/Build.pm> and modified to take into an +account Win32's C<PATHEXT> environment variable or the hardcoded list +of known executable extensions for Win9x which doesn't have this +variable. =item * dumper 1.5 +9 -15 modperl-docs/lib/DocSet/Doc/Common.pm Index: Common.pm =================================================================== RCS file: /home/cvs/modperl-docs/lib/DocSet/Doc/Common.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Common.pm 25 Mar 2002 17:08:04 -0000 1.4 +++ Common.pm 13 Apr 2002 15:44:20 -0000 1.5 @@ -140,11 +140,12 @@ $anchor =~ s/^\s*|\s*$//g; # strip leading and closing spaces $anchor =~ s/\W/_/g; my $link = $title->present($self); - return qq{<a name="$anchor">$link</a>}; + return qq{<a name="$anchor"></a><a href="#toc_$anchor">$link</a>}; } # we want the pre sections look different from normal text. So we use -# the vertical bar on the left +# the vertical bar on the left. make sure to set the td.pre-bar class +# style.css: td.pre-bar { background-color: #cccccc; } sub pod_pom_html_view_verbatim { my ($self, $text) = @_; for ($text) { @@ -154,18 +155,11 @@ } return <<PRE_SECTION; -<table> - <tr> - - <td bgcolor="#cccccc" width="1"> - <br> - </td> - - <td> - <pre>$text</pre> - </td> - - </tr> +<table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td class="pre-bar" width="1"><br></td> + <td><pre>$text</pre></td> + </tr> </table> PRE_SECTION @@ -255,7 +249,7 @@ my $anchor = $self->pod_pom_html_anchor($title); -this is common function that takes the C<$title> Pod::POM object, +this is a common function that takes the C<$title> Pod::POM object, converts it into a E<lt>a nameE<gt> html anchor and returns it. =item * pod_pom_html_view_verbatim 1.5 +7 -4 modperl-docs/lib/DocSet/Source/POD.pm Index: POD.pm =================================================================== RCS file: /home/cvs/modperl-docs/lib/DocSet/Source/POD.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- POD.pm 22 Mar 2002 02:01:52 -0000 1.4 +++ POD.pm 13 Apr 2002 15:44:20 -0000 1.5 @@ -96,12 +96,15 @@ my $link = "$title"; # must stringify to get the raw string $link =~ s/^\s*|\s*$//g; # strip leading and closing spaces $link =~ s/\W/_/g; # META: put into a sub? see Doc::Common::pod_pom_html_anchor - $link = "#$link"; # prepand '#' for internal links + # prepand '#' for internal links + my $toc_link = "toc_$link"; # self referring toc entry + $link = "#$link"; my %toc_entry = ( - title => $title->present($mode), # run the formatting if any - link => $link, - ); + title => $title->present($mode), # run the formatting if any + link => $link, + toc_link => $toc_link, + ); my @sub = (); $level++;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]