+}
+
+=head2 fs_pod2html_from_src output_dir
+
+Generate Freeside-themed HTML documentation from a Freeside source tree
+
+Will fail, unless run with CWD at the root of the Freesidse source tree
+
+=cut
+
+sub fs_pod2html_from_src {
+ my $html_dir = shift;
+
+ fs_pod2html_from_dirs(
+ $html_dir,
+ 'FS/bin',
+ 'bin',
+ 'FS',
+ 'fs_selfservice/FS-SelfService',
+ # '/usr/local/share/perl/5.24.1',
+ # '/usr/local/bin',
+ $include_system_perl_modules ? (
+ '/usr/share/perl5',
+ '/usr/share/perl/5.24',
+ '/usr/share/perl/5.24.1',
+ ) : (),
+ );
+
+ # FS-SelfService is loosely packaged:
+ # perl modules are not stored in lib/FS, scripts not stored in /bin, so
+ # batch_convert() places these .html in the wrong locations
+ #
+ # Copy to correct locations, and correct relative links
+ copy( "$html_dir/SelfService.html", "$html_dir/FS/SelfService.html" );
+ mkdir( "$html_dir/FS/SelfService" );
+ copy( "$html_dir/SelfService/XMLRPC.html", "$html_dir/FS/SelfService/XMLRPC.html" );
+ for my $sed_cmd (
+ 'sed -i "s/href=\"\.\//href=\"\.\.\//g" "'.$html_dir.'/FS/SelfService.html"',
+ 'sed -i "s/href=\"\\..\//href=\"\.\.\/\.\.\//g" "'.$html_dir.'/FS/SelfService/XMLRPC.html"',
+ ) {
+ `$sed_cmd`
+ }
+}
+
+=head2 fs_pod2html output_dir @source_scan_dirs
+
+Generate Freeside-themed HTML documentation, scanning the provided directories
+
+=cut
+
+sub fs_pod2html_from_dirs {
+ my $html_dir = shift
+ or croak 'Please specify an output directory';
+
+ croak "Directory $html_dir: No write access"
+ unless -w $html_dir;
+
+ my @search_dirs = @_;
+
+ for my $dir ( @search_dirs ) {
+ unless ( -d $dir ) {
+ croak "Cannot continue - source directory ($dir) not found! ";
+ }
+ }