| 1 | #!/usr/local/bin/perl | ||
| 2 | #!perl | ||
| 3 | use Getopt::Long qw(:config no_ignore_case); | ||
| 4 | use Pod::Usage; | ||
| 5 | use Pod::Classdoc::Project qw(renderProject); | ||
| 6 | use Cwd; | ||
| 7 | |||
| 8 | use strict; | ||
| 9 | use warnings; | ||
| 10 | |||
| 11 | our $VERSION = '1.01'; | ||
| 12 | |||
| 13 | my ($help, $out, $lib, $title, $lang, $desc, $charset, $index, $verbose, $forcegen, $nosrc); | ||
| 14 | my ($nocomments, $noexpand, $noimports, $jspath, $lines, $openimg, $imgpath, $nopod, | ||
| 15 | $rootimg, $csspath, $closeimg, $noicons, $notree, $download, $additions, $noheredocs, | ||
| 16 | $order); | ||
| 17 | my @sources = (); | ||
| 18 | my %opt = ( | ||
| 19 | 'additions|a=s' => \$additions, | ||
| 20 | 'nocomments|C' => \$nocomments, | ||
| 21 | 'charset|c=s' => \$charset, | ||
| 22 | 'desc|d=s' => \$desc, | ||
| 23 | 'download|D=s' => \$download, | ||
| 24 | 'noexpand|e' => \$noexpand, | ||
| 25 | 'forcegen!' => \$forcegen, | ||
| 26 | 'help|h' => \$help, | ||
| 27 | 'noheredoc|H' => \$noheredocs, | ||
| 28 | 'noimports|I' => \$noimports, | ||
| 29 | 'imgpath|i=s' => \$imgpath, | ||
| 30 | 'jspath|j=s' => \$jspath, | ||
| 31 | 'lang|L=s' => \$lang, | ||
| 32 | 'lib|l=s' => sub { push @sources, $_[1]; }, | ||
| 33 | 'lines|N=i' => \$lines, | ||
| 34 | 'nosrc|n' => \$nosrc, | ||
| 35 | 'openimg|O=s' => \$openimg, | ||
| 36 | 'output|out|o=s' => \$out, | ||
| 37 | 'nopod|p' => \$nopod, | ||
| 38 | 'rootimg|r=s' => \$rootimg, | ||
| 39 | 'css|s=s' => \$csspath, | ||
| 40 | 'title|t=s' => \$title, | ||
| 41 | 'verbose|v' => \$verbose, | ||
| 42 | 'closeimg|x=s' => \$closeimg, | ||
| 43 | 'order|y=s' => \$order, | ||
| 44 | 'noicons|z' => \$noicons, | ||
| 45 | ); | ||
| 46 | |||
| 47 | GetOptions(%opt); | ||
| 48 | |||
| 49 | pod2usage(1) if $help; | ||
| 50 | |||
| 51 | my @order = $order ? split(/\s*,\s*/, $order) : (); | ||
| 52 | |||
| 53 | $| = 1 if $verbose; | ||
| 54 | |||
| 55 | renderProject( | ||
| 56 | Additions => $additions, | ||
| 57 | Charset => $charset, | ||
| 58 | CloseImage => $closeimg, | ||
| 59 | Comments => !$nocomments, | ||
| 60 | Description => $desc, | ||
| 61 | Download => $download, | ||
| 62 | Expandable => !$noexpand, | ||
| 63 | Force => $forcegen, | ||
| 64 | Heredoc => !$noheredocs, | ||
| 65 | Imports => !$noimports, | ||
| 66 | IconPath => $imgpath, | ||
| 67 | JSPath => $jspath, | ||
| 68 | Language => $lang, | ||
| 69 | Libs => \@sources, | ||
| 70 | MinLines => $lines, | ||
| 71 | NoIcons => $noicons, | ||
| 72 | NoSource => $nosrc, | ||
| 73 | OpenImage => $openimg, | ||
| 74 | Order => \@order, | ||
| 75 | Output => $out, | ||
| 76 | POD => !$nopod, | ||
| 77 | RootImage => $rootimg, | ||
| 78 | CSSPath => $csspath, | ||
| 79 | Title => $title, | ||
| 80 | Verbose => $verbose, | ||
| 81 | ); | ||
| 82 | |||
| 83 | =pod | ||
| 84 | |||
| 85 | =head1 NAME | ||
| 86 | |||
| 87 | mkprojdocs | ||
| 88 | |||
| 89 | =head1 SYNOPSIS | ||
| 90 | |||
| 91 | mkprojdocs [options] | ||
| 92 | |||
| 93 | Options: | ||
| 94 | -a|-additions <filename> additional HTML lists to include in TOC | ||
| 95 | -C|-nocomments disable comment folding in source; | ||
| 96 | default enabled | ||
| 97 | -c|-charset <string> set character set meta tag in html; | ||
| 98 | default 'UTF-8' | ||
| 99 | -d|-desc <string> project description | ||
| 100 | -D|-download <filename> path to a download file for project | ||
| 101 | -e|-noexpand disable expandable source folds; | ||
| 102 | default enabled | ||
| 103 | -f|-forcegen force regeneration | ||
| 104 | -h|-help display this help and exit | ||
| 105 | -H|-noheredoc disable heredoc folding (default enabled) | ||
| 106 | -I|-noimports disable imports folding (default enabled) | ||
| 107 | -i|-imgpath <path> path to icon image directory; default 'img' | ||
| 108 | -j|-jspath <path> path to Javascript files; default 'js' | ||
| 109 | -l|-lib <path> project library-root-directory path | ||
| 110 | -L|-lang <language> language for xml:lang. default 'en' | ||
| 111 | -N|-lines <number> minimum consecutive foldable lines req'd | ||
| 112 | for fold (default 4) | ||
| 113 | -n|-nosrc skip PPI::HTML::CodeFolder generation | ||
| 114 | -O|-openimg <filename> image file used for HTML::ListToTree open | ||
| 115 | nodes; default 'openbook.gif' | ||
| 116 | -o|-out|-output <path> target directory path for generated documents | ||
| 117 | -p|-nopod disable POD folding (default enabled) | ||
| 118 | -r|-rootimg <filename> image file used for root of TOC tree; | ||
| 119 | default 'globe.gif' | ||
| 120 | -s|-css <path> path to CSS files; default 'css' | ||
| 121 | -t|-title <title> project title | ||
| 122 | -v|-verbose enable diagnostic messages | ||
| 123 | -x|-closeimg <filename> image file used for closed TOC nodes; | ||
| 124 | default 'closedbook.gif' | ||
| 125 | -y|-order "<pkglist>" specify order of packages in TOC; | ||
| 126 | <pkglist> is comma separated list of | ||
| 127 | names, e.g., | ||
| 128 | "DBI,DBD::_::dr,DBD::_::db,DBD::_::st" | ||
| 129 | -z|-noicons no icons in tree widget; default is icons on | ||
| 130 | |||
| 131 | Multiple library-directories cna be specified: | ||
| 132 | |||
| 133 | mkprojdocs -o /path/to/outputdir -l /path/to/lib1 -l /path/to/lib2 | ||
| 134 | |||
| 135 | =head1 DESCRIPTION | ||
| 136 | |||
| 137 | Generates merged L<Pod::ProjectDocs> (for POD), L<Pod::Classdoc> (for classdocs), and | ||
| 138 | L<PPI::HTML::CodeFolder> (for source code) output with a Javascript navigation | ||
| 139 | tree widget generated via L<HTML::ListToTree>. | ||
| 140 | |||
| 141 | =cut |