added thumbs
Tobias Leich [Tue, 17 Nov 2009 18:49:24 +0000 (19:49 +0100)]
htdocs/assets/SDL_thumb.png [new file with mode: 0644]
htdocs/assets/bubble-1-mini.png [new file with mode: 0644]
htdocs/assets/bubble-2-mini.png [new file with mode: 0644]
htdocs/assets/bubble-3-mini.png [new file with mode: 0644]
htdocs/assets/bubble-4-mini.png [new file with mode: 0644]
htdocs/assets/bubble-5-mini.png [new file with mode: 0644]
htdocs/assets/bubble-6-mini.png [new file with mode: 0644]
htdocs/assets/bubble-7-mini.png [new file with mode: 0644]
htdocs/assets/bubble-8-mini.png [new file with mode: 0644]
pages/documentation.html-inc
tools/PM-Pod2html-snippet.pl

diff --git a/htdocs/assets/SDL_thumb.png b/htdocs/assets/SDL_thumb.png
new file mode 100644 (file)
index 0000000..613e48f
Binary files /dev/null and b/htdocs/assets/SDL_thumb.png differ
diff --git a/htdocs/assets/bubble-1-mini.png b/htdocs/assets/bubble-1-mini.png
new file mode 100644 (file)
index 0000000..613e48f
Binary files /dev/null and b/htdocs/assets/bubble-1-mini.png differ
diff --git a/htdocs/assets/bubble-2-mini.png b/htdocs/assets/bubble-2-mini.png
new file mode 100644 (file)
index 0000000..02b30ed
Binary files /dev/null and b/htdocs/assets/bubble-2-mini.png differ
diff --git a/htdocs/assets/bubble-3-mini.png b/htdocs/assets/bubble-3-mini.png
new file mode 100644 (file)
index 0000000..75acbc4
Binary files /dev/null and b/htdocs/assets/bubble-3-mini.png differ
diff --git a/htdocs/assets/bubble-4-mini.png b/htdocs/assets/bubble-4-mini.png
new file mode 100644 (file)
index 0000000..639ec20
Binary files /dev/null and b/htdocs/assets/bubble-4-mini.png differ
diff --git a/htdocs/assets/bubble-5-mini.png b/htdocs/assets/bubble-5-mini.png
new file mode 100644 (file)
index 0000000..cf2fbe9
Binary files /dev/null and b/htdocs/assets/bubble-5-mini.png differ
diff --git a/htdocs/assets/bubble-6-mini.png b/htdocs/assets/bubble-6-mini.png
new file mode 100644 (file)
index 0000000..46db2f6
Binary files /dev/null and b/htdocs/assets/bubble-6-mini.png differ
diff --git a/htdocs/assets/bubble-7-mini.png b/htdocs/assets/bubble-7-mini.png
new file mode 100644 (file)
index 0000000..c1f1274
Binary files /dev/null and b/htdocs/assets/bubble-7-mini.png differ
diff --git a/htdocs/assets/bubble-8-mini.png b/htdocs/assets/bubble-8-mini.png
new file mode 100644 (file)
index 0000000..a8b7160
Binary files /dev/null and b/htdocs/assets/bubble-8-mini.png differ
index 2f59243..e2bb346 100644 (file)
@@ -1,2 +1,2 @@
 <div class="pod">
-<h1>Documentation (latest development branch)</h1><a href="SDL.html">SDL</a><br /><a href="SDL-App.html">SDL::App</a><br /><a href="SDL-Cdrom.html">SDL::Cdrom</a><br /><a href="SDL-Color.html">SDL::Color</a><br /><a href="SDL-Cookbook.html">SDL::Cookbook</a><br /><a href="SDL-Cookbook-PDL.html">SDL::Cookbook::PDL</a><br /><a href="SDL-Cursor.html">SDL::Cursor</a><br /><a href="SDL-Event.html">SDL::Event</a><br /><a href="SDL-Events.html">SDL::Events</a><br /><a href="SDL-Font.html">SDL::Font</a><br /><a href="SDL-Game-Palette.html">SDL::Game::Palette</a><br /><a href="SDL-MPEG.html">SDL::MPEG</a><br /><a href="SDL-Mixer.html">SDL::Mixer</a><br /><a href="SDL-MultiThread.html">SDL::MultiThread</a><br /><a href="SDL-Music.html">SDL::Music</a><br /><a href="SDL-OpenGL.html">SDL::OpenGL</a><br /><a href="SDL-Overlay.html">SDL::Overlay</a><br /><a href="SDL-Palette.html">SDL::Palette</a><br /><a href="SDL-PixelFormat.html">SDL::PixelFormat</a><br /><a href="SDL-Rect.html">SDL::Rect</a><br /><a href="SDL-SFont.html">SDL::SFont</a><br /><a href="SDL-SMPEG.html">SDL::SMPEG</a><br /><a href="SDL-Sound.html">SDL::Sound</a><br /><a href="SDL-Surface.html">SDL::Surface</a><br /><a href="SDL-TTFont.html">SDL::TTFont</a><br /><a href="SDL-Timer.html">SDL::Timer</a><br /><a href="SDL-Tool-Font.html">SDL::Tool::Font</a><br /><a href="SDL-Tool-Graphic.html">SDL::Tool::Graphic</a><br /><a href="SDL-Tutorial.html">SDL::Tutorial</a><br /><a href="SDL-Tutorial-Animation.html">SDL::Tutorial::Animation</a><br /><a href="SDL-Tutorial-Images.html">SDL::Tutorial::Images</a><br /><a href="SDL-Tutorial-LunarLander.html">SDL::Tutorial::LunarLander</a><br /><a href="SDL-Tutorial-Pong.html">SDL::Tutorial::Pong</a><br /><a href="SDL-Tutorial-Tetris.html">SDL::Tutorial::Tetris</a><br /><a href="SDL-Video.html">SDL::Video</a><br /><a href="SDL-VideoInfo.html">SDL::VideoInfo</a><br /><a href="Time.html">Time</a><br /></div>
+<h1>Documentation (latest development branch)</h1><table><tr><td><img src="assets/SDL_thumb.png" alt="thumb" /></td><td><a href="SDL.html">SDL </a></td><td>  Simple DirectMedia Layer for Perl</td></tr><tr><td><img src="assets/bubble-5-mini.png" alt="thumb" /></td><td><a href="SDL-App.html">SDL::App </a></td><td>  a SDL perl extension</td></tr><tr><td><img src="assets/bubble-2-mini.png" alt="thumb" /></td><td><a href="SDL-Cdrom.html">SDL::Cdrom </a></td><td>  a SDL perl extension for managing CD-ROM drives</td></tr><tr><td><img src="assets/bubble-3-mini.png" alt="thumb" /></td><td><a href="SDL-Color.html">SDL::Color </a></td><td>  Format independent color description</td></tr><tr><td><img src="assets/bubble-1-mini.png" alt="thumb" /></td><td><a href="SDL-Cookbook.html">SDL::Cookbook</a></td><td></td></tr><tr><td><img src="assets/bubble-7-mini.png" alt="thumb" /></td><td><a href="SDL-Cookbook-PDL.html">SDL::Cookbook::PDL</a></td><td></td></tr><tr><td><img src="assets/bubble-1-mini.png" alt="thumb" /></td><td><a href="SDL-Cursor.html">SDL::Cursor </a></td><td>  a SDL perl extension</td></tr><tr><td><img src="assets/bubble-5-mini.png" alt="thumb" /></td><td><a href="SDL-Event.html">SDL::Event </a></td><td>  General event structure</td></tr><tr><td><img src="assets/bubble-6-mini.png" alt="thumb" /></td><td><a href="SDL-Events.html">SDL::Events </a></td><td>  Bindings to the Events Category in SDL API</td></tr><tr><td><img src="assets/bubble-7-mini.png" alt="thumb" /></td><td><a href="SDL-Font.html">SDL::Font </a></td><td>  a SDL perl extension</td></tr><tr><td><img src="assets/bubble-3-mini.png" alt="thumb" /></td><td><a href="SDL-Game-Palette.html">SDL::Game::Palette </a></td><td>  a perl extension</td></tr><tr><td><img src="assets/bubble-6-mini.png" alt="thumb" /></td><td><a href="SDL-MPEG.html">SDL::MPEG </a></td><td>  a SDL perl extension</td></tr><tr><td><img src="assets/bubble-2-mini.png" alt="thumb" /></td><td><a href="SDL-Mixer.html">SDL::Mixer </a></td><td>  a SDL perl extension</td></tr><tr><td><img src="assets/bubble-5-mini.png" alt="thumb" /></td><td><a href="SDL-MultiThread.html">SDL::MultiThread </a></td><td>  Bindings to the MultiThread category in SDL API</td></tr><tr><td><img src="assets/bubble-1-mini.png" alt="thumb" /></td><td><a href="SDL-Music.html">SDL::Music </a></td><td>  a perl extension</td></tr><tr><td><img src="assets/bubble-6-mini.png" alt="thumb" /></td><td><a href="SDL-OpenGL.html">SDL::OpenGL </a></td><td>  a perl extension</td></tr><tr><td><img src="assets/bubble-1-mini.png" alt="thumb" /></td><td><a href="SDL-Overlay.html">SDL::Overlay </a></td><td>  YUV Video overlay</td></tr><tr><td><img src="assets/bubble-4-mini.png" alt="thumb" /></td><td><a href="SDL-Palette.html">SDL::Palette </a></td><td>  a perl extension</td></tr><tr><td><img src="assets/bubble-7-mini.png" alt="thumb" /></td><td><a href="SDL-PixelFormat.html">SDL::PixelFormat </a></td><td>  Stores surface format information</td></tr><tr><td><img src="assets/bubble-4-mini.png" alt="thumb" /></td><td><a href="SDL-Rect.html">SDL::Rect </a></td><td>  Defines a rectangular area</td></tr><tr><td><img src="assets/bubble-5-mini.png" alt="thumb" /></td><td><a href="SDL-SFont.html">SDL::SFont </a></td><td>  a perl extension</td></tr><tr><td><img src="assets/bubble-3-mini.png" alt="thumb" /></td><td><a href="SDL-SMPEG.html">SDL::SMPEG </a></td><td>  a SDL perl extension</td></tr><tr><td><img src="assets/bubble-6-mini.png" alt="thumb" /></td><td><a href="SDL-Sound.html">SDL::Sound </a></td><td>  a perl extension</td></tr><tr><td><img src="assets/bubble-5-mini.png" alt="thumb" /></td><td><a href="SDL-Surface.html">SDL::Surface</a></td><td></td></tr><tr><td><img src="assets/bubble-7-mini.png" alt="thumb" /></td><td><a href="SDL-TTFont.html">SDL::TTFont </a></td><td>  a SDL perl extension</td></tr><tr><td><img src="assets/bubble-5-mini.png" alt="thumb" /></td><td><a href="SDL-Timer.html">SDL::Timer </a></td><td>  a SDL perl extension to handle timers</td></tr><tr><td><img src="assets/bubble-1-mini.png" alt="thumb" /></td><td><a href="SDL-Tool-Font.html">SDL::Tool::Font </a></td><td>  a perl extension</td></tr><tr><td><img src="assets/bubble-7-mini.png" alt="thumb" /></td><td><a href="SDL-Tool-Graphic.html">SDL::Tool::Graphic</a></td><td></td></tr><tr><td><img src="assets/bubble-7-mini.png" alt="thumb" /></td><td><a href="SDL-Tutorial.html">SDL::Tutorial </a></td><td>  introduction to Perl SDL</td></tr><tr><td><img src="assets/bubble-4-mini.png" alt="thumb" /></td><td><a href="SDL-Tutorial-Animation.html">SDL::Tutorial::Animation</a></td><td></td></tr><tr><td><img src="assets/bubble-2-mini.png" alt="thumb" /></td><td><a href="SDL-Tutorial-Images.html">SDL::Tutorial::Images</a></td><td></td></tr><tr><td><img src="assets/bubble-7-mini.png" alt="thumb" /></td><td><a href="SDL-Tutorial-LunarLander.html">SDL::Tutorial::LunarLander </a></td><td>  a small tutorial on Perl SDL</td></tr><tr><td><img src="assets/bubble-3-mini.png" alt="thumb" /></td><td><a href="SDL-Tutorial-Pong.html">SDL::Tutorial::Pong</a></td><td></td></tr><tr><td><img src="assets/bubble-3-mini.png" alt="thumb" /></td><td><a href="SDL-Tutorial-Tetris.html">SDL::Tutorial::Tetris</a></td><td></td></tr><tr><td><img src="assets/bubble-2-mini.png" alt="thumb" /></td><td><a href="SDL-Video.html">SDL::Video </a></td><td>  Bindings to the video category in SDL API</td></tr><tr><td><img src="assets/bubble-6-mini.png" alt="thumb" /></td><td><a href="SDL-VideoInfo.html">SDL::VideoInfo </a></td><td>  Video Target Information </td></tr><tr><td><img src="assets/bubble-6-mini.png" alt="thumb" /></td><td><a href="Time.html">Time </a></td><td>  a SDL perl extension for managing timers.</td></tr></table></div>
index 09c30bf..f93cf9a 100644 (file)
@@ -18,6 +18,7 @@ my $pages_path      = catdir($parent_dir, 'pages');
 my $assets_path     = catdir($parent_dir, 'htdocs/assets');
 my $parser          = Pod::Xhtml->new(FragmentOnly => 1, StringMode => 1);
 my %module_names    = ();
+my %thumbnails      = ();
 my $fh;
 
 read_file($input_path);
@@ -25,15 +26,28 @@ read_file($input_path);
 # creating index file
 open($fh, '>', File::Spec->catfile($pages_path, 'documentation.html-inc'));
 binmode($fh, ":utf8");
-print($fh "<div class=\"pod\">\n<h1>Documentation (latest development branch)</h1>");
+print($fh "<div class=\"pod\">\n<h1>Documentation (latest development branch)</h1><table>");
 for my $module_name (sort keys %module_names)
 {
-       print($fh '<a href="' . $module_names{$module_name} . '">',
-                 $module_name, 
-                 '</a><br />'
-       );
+       my $icon = sprintf('<img src="assets/bubble-%d-mini.png" alt="thumb" />', int((rand() * 7) + 1));
+       my $name = $module_name;
+       my $desc = '';
+       
+       if($module_name =~ /^([^\-]+)\-(.+)$/)
+       {
+               $name = $1;
+               $desc = $2;
+       }
+       
+       if(defined $thumbnails{$module_name})
+       {
+               $icon = sprintf('<img src="assets/%s" alt="thumb" />', $thumbnails{$module_name});
+       }
+       
+       printf($fh '<tr><td>%s</td><td><a href="%s">%s</a></td><td>%s</td></tr>', 
+                  $icon, $module_names{$module_name}, $name, $desc);
 }
-print($fh "</div>\n");
+print($fh "</table></div>\n");
 close($fh);
 
 sub read_file
@@ -46,6 +60,23 @@ sub read_file
                read_file($_) if(-d $_);
                if($_ =~ /\.pod$/i)
                {
+                       my $file_name   = $_;
+                          $file_name   =~ s/^$input_path\/*//;
+                       my $module_name = $file_name;
+                          $module_name =~ s/\//::/g;
+                          $module_name =~ s/(\.pm|\.pod)$//i;
+                          $file_name   =~ s/\//-/g;
+                          $file_name   =~ s/(\.pm|\.pod)$/.html-inc/i;
+                       my $file_path   = $file_name;
+                          $file_path   =~ s/\-inc$//;
+                          $file_name   = File::Spec->catfile($pages_path, $file_name);
+                       $parser->parse_from_file($_); #, $file_name);
+                       
+                       $module_name .= " - $1" if $parser->asString =~ /<div id="NAME_CONTENT">\s*<p>\s*[^<>\-]+\-([^<>]+)\s*<\/p>\s*<\/div>/;
+                       
+                       $module_names{$module_name} = $file_path;
+
+                       # handling images
                        my $image_path  = $_;
                           $image_path  =~ s/\.pod$//;
                        my @images = <$image_path*>;
@@ -54,32 +85,25 @@ sub read_file
                        
                        foreach my $image_file (@images)
                        {
-                               if($image_file =~ /^($image_path)(_\d+){0,1}\.(jpg|jpeg|png|gif)$/)
+                               if($image_file =~ /^($image_path)(_\w+){0,1}\.(jpg|jpeg|png|gif)$/)
                                {
                                        my (undef, undef, $image_file_name) = splitpath($image_file);
                                        
-                                       $image_html .= sprintf('<a href="assets/%s" target="_blank">'
-                                                                . '<img src="assets/%s" style="height: 160px" alt="%s"/>'
-                                                            . '</a>', $image_file_name, $image_file_name, $image_file_name);
-                                       
+                                       if($image_file_name =~ /_thumb\.(jpg|jpeg|png|gif)$/)
+                                       {
+                                               $thumbnails{$module_name} = $image_file_name;
+                                       }
+                                       else
+                                       {
+                                               $image_html .= sprintf('<a href="assets/%s" target="_blank">'
+                                                                        . '<img src="assets/%s" style="height: 160px" alt="%s"/>'
+                                                                    . '</a>', $image_file_name, $image_file_name, $image_file_name);
+                                       }
+                                                                               
                                        copy($image_file, File::Spec->catfile($assets_path, $image_file_name));
                                }
                        }
                        
-                       my $file_name   = $_;
-                          $file_name   =~ s/^$input_path\/*//;
-                       my $module_name = $file_name;
-                          $module_name =~ s/\//::/g;
-                          $module_name =~ s/(\.pm|\.pod)$//i;
-                          $file_name   =~ s/\//-/g;
-                          $file_name   =~ s/(\.pm|\.pod)$/.html-inc/i;
-                       my $file_path   = $file_name;
-                          $file_path   =~ s/\-inc$//;
-                       $module_names{$module_name} = $file_path;
-                          $file_name   = File::Spec->catfile($pages_path, $file_name);
-
-                       $parser->parse_from_file($_); #, $file_name);
-                       
                        # modifying the html-snippet and insert the images
                        my $html = $parser->asString;
                           $html =~ s/<!-- INDEX END -->/<!-- INDEX END -->$image_html<hr \/>/ if $image_html;