Changeset 1593
- Timestamp:
- 01/19/05 02:05:07 (4 years ago)
- Files:
-
- trunk/swish_website/Plugin/My/POD.pm (modified) (5 diffs)
- trunk/swish_website/README (modified) (2 diffs)
- trunk/swish_website/bin/split.pl (modified) (5 diffs)
- trunk/swish_website/etc (added)
- trunk/swish_website/etc/spider.config (added)
- trunk/swish_website/etc/swish.config (added)
- trunk/swish_website/lib/page/podpage (modified) (1 diff)
- trunk/swish_website/lib/page/search.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/swish_website/Plugin/My/POD.pm
r1587 r1593 7 7 use vars '@pod_toc'; 8 8 9 10 my $mode = 'Pod::POM::View::HTML'; # The view module 11 12 # Much of this is based on (or copied from) Stas' DocSet 0.17 9 my %split_by = map {"head".$_ => 1} 1..4; 10 11 my $view_mode = 'Pod::POM::View::HTML'; # The view module 12 13 # *Much* of this is based on (or copied from) Stas' DocSet 0.17 13 14 # I'm not sure why spaces need to be removed from links. Pod::POM doesn't remove them. 14 15 … … 42 43 43 44 $data{sections} = \@sections; 45 46 $data{podparts} = [ slice_by_head(@sections) ]; 44 47 45 48 $data{toc} = fetch_toc( \@sections ); … … 61 64 } 62 65 66 sub slice_by_head { 67 my @sections = @_; 68 my @body = (); 69 for my $node (@sections) { 70 my @next = (); 71 # assumption, after the first 'headX' section, there can only 72 # be other 'headX' sections 73 my $count = scalar $node->content; 74 my $id = -1; 75 for ($node->content) { 76 $id++; 77 next unless exists $split_by{ $_->type }; 78 @next = splice @{$node->content}, $id; 79 last; 80 } 81 push @body, $node, slice_by_head(@next); 82 } 83 return @body; 84 } 85 63 86 sub combine_verbatim_sections_hack { 64 87 my $tree = shift; … … 88 111 next unless $sections->[$_] && $sections->[$_]->title =~ /DESCRIPTION|OVERVIEW/; 89 112 90 my $abstract = $sections->[$_]->content->present($ mode);113 my $abstract = $sections->[$_]->content->present($view_mode); 91 114 $abstract =~ s|<p>(.*?)</p>.*|$1|s; 92 115 return $abstract; … … 122 145 123 146 my %toc_entry = ( 124 title => $title->present($ mode), # run the formatting if any147 title => $title->present($view_mode), # run the formatting if any 125 148 link => "#$title", 126 149 ); trunk/swish_website/README
r1591 r1593 113 113 ------------------------------ 114 114 115 [todo] 115 To index the site run from the top level directory: 116 117 $ SWISH_SITE=http://swish-e.org swish-e -c etc/swish.config -S prog 118 119 SWISH_SITE is the top level URL. 120 START_FILE is the starting file. Default is index.html 121 (SWISH_SITE=http://swish-e.org/docs START_FILE=readme.html to index just one file) 122 123 That writes the index to public_html/search/ 124 125 Or to run it quiet: 126 127 $ SPIDER_QUIET=1 SWISH_SITE=http://localhost/apache/public_html \ 128 swish-e -c etc/swish.config -S prog -v0 129 130 Capture output (for debugging) like this: 131 132 $ SWISH_SITE=http://localhost/apache/public_html \ 133 /usr/local/lib/swish-e/spider.pl etc/spider.config > out 134 135 136 137 todo: add metaname selection and create build script that is built from 116 138 117 139 … … 137 159 - enable template caching for the search script 138 160 161 - Probably should filter all hrefs= and name= through |uri|html. Plus some 162 are very large. Maybe shorten or md5 them? If so, then need to adjust link_to_page(). 139 163 140 164 165 trunk/swish_website/bin/split.pl
r1587 r1593 1 1 #!/usr/bin/perl -w 2 2 use strict; 3 use warnings; 3 4 use File::Find; 4 5 5 6 my $dir = shift || die "failed to specify directory"; 7 my $pat = qr!<h\d><a name="([^"]+)"></a>([^<]+)</h\d>!i; #" for vim 8 9 10 if ( -f $dir ) { 11 warn "Indexing [$dir] as a single file\n"; 12 index_path( $dir ); 13 exit; 14 } 6 15 7 16 find( \&process_doc, $dir ); … … 11 20 12 21 13 my $pat = qr[<h\d><a name="([^"]+)">([^<]+)</a></h\d>]i;14 22 15 23 … … 31 39 return if $dir =~ m!/graphics!; 32 40 41 index_path( $path ); 42 } 43 44 sub index_path { 45 my ( $path ) = @_; 33 46 34 47 unless ( open( FH, "<$path" ) ) { 35 warn "Failed to open file [$path]\n";48 warn "Failed to open file - [$path]: $!\n"; 36 49 return; 37 50 } … … 43 56 sub index_doc { 44 57 my ($name, $doc) = @_; 58 45 59 46 60 … … 55 69 $title ||= "Swish-e Documentation"; 56 70 57 $title =~ s/^S WISH-Enhanced: //;71 $title =~ s/^Swish-e :: //; 58 72 59 73 trunk/swish_website/lib/page/podpage
r1587 r1593 20 20 <hr> 21 21 22 [% FOREACH section = pom.sections %] 23 [% section.present(view) %] 22 [% FOREACH section = pom.podparts %] 23 <div class="sub-section"> 24 [% section.present(view) %] 25 </div> 24 26 [% END %] 25 27 trunk/swish_website/lib/page/search.html
r1587 r1593 86 86 87 87 <div class="search-title"> 88 <a href="[% item.Property('swishdocpath') | uri | html%]">88 <a href="[% item.Property('swishdocpath') %]"> 89 89 [% item.Property('swishtitle') || 'missing title' | highlight('swishtitle', item ) %]</a> 90 90 … … 97 97 98 98 <div class="search-metadata"> 99 Path: <a href="[% item.Property('swishdocpath') | uri | html%]">99 Path: <a href="[% item.Property('swishdocpath') %]"> 100 100 [% item.Property('swishdocpath') | highlight('swishdocpath', item ) %]</a> 101 101 - [% item.Property('swishdocsize') %] bytes<br>
