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=816558fd15dd150ae3fb5102553cce66212cdfc8;hb=4e1ad99d1b08ee2b487c3c7bbf60e0abe502c054;hp=0000000000000000000000000000000000000000;hpb=61a54f8a06cbc1066f8324b3d3de7d18253c3fd3;p=sdlgit%2FSDL-Site.git diff --git a/tools/PM-Pod2html-snippet.pl b/tools/PM-Pod2html-snippet.pl new file mode 100644 index 0000000..816558f --- /dev/null +++ b/tools/PM-Pod2html-snippet.pl @@ -0,0 +1,59 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +use File::Spec; +use Pod::Xhtml; + +#system('git pull'); + +my $input_path = 'C:/SDL_perl/lib/pods'; +my $output_path = 'F:/htdocs/SDL-Site/pages'; +my $parser = Pod::Xhtml->new(FragmentOnly => 1); +my %module_names = (); +my $fh; + +read_file($input_path); + +# creating index file +open($fh, '>', File::Spec->catfile($output_path, 'documentation.html-inc')); +binmode($fh, ":utf8"); +print($fh "
\n

Documentation (latest development branch)

"); +for my $module_name (sort keys %module_names) +{ + print($fh '', + $module_name, + '
' + ); +} +print($fh "
\n"); +close($fh); + +sub read_file +{ + my $path = shift; + my @files = <$path/*>; + + foreach(@files) + { + 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$//; + $module_names{$module_name} = $file_path; + $file_name = File::Spec->catfile($output_path, $file_name); + + $parser->parse_from_file($_, $file_name); + } + } +}