X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=tools%2FPM-Pod2html-snippet.pl;fp=tools%2FPM-Pod2html-snippet.pl;h=f93cf9a4c1ec2e99b198aa086cfdf9352c3b3542;hb=9f2a2b915fdd9ae0af4322660b86b52dbc8603c2;hp=09c30bf0f497d14e54d88314286671583a0a1a2f;hpb=8a309dcbcd8f0302e48f583d7f4c6bd36493a7ce;p=sdlgit%2FSDL-Site.git diff --git a/tools/PM-Pod2html-snippet.pl b/tools/PM-Pod2html-snippet.pl index 09c30bf..f93cf9a 100644 --- a/tools/PM-Pod2html-snippet.pl +++ b/tools/PM-Pod2html-snippet.pl @@ -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 "
%s | %s | %s |
\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(''
- . ''
- . '', $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(''
+ . '
'
+ . '', $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//$image_html