[freeside-commits] branch master updated. 9a74b15fe926c37f00added2d034d34bf6c95d7f

Mitch Jackson mitch at freeside.biz
Thu Jan 31 22:50:31 PST 2019


The branch, master has been updated
       via  9a74b15fe926c37f00added2d034d34bf6c95d7f (commit)
      from  911ad81c95f3ed15f84d926a93e12185c2c073a6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9a74b15fe926c37f00added2d034d34bf6c95d7f
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Fri Feb 1 01:49:33 2019 -0500

    RT# 81961 Include HTML for POD documentation

diff --git a/Makefile b/Makefile
index d773aa367..301dc4132 100644
--- a/Makefile
+++ b/Makefile
@@ -49,6 +49,8 @@ FREESIDE_DOCUMENT_ROOT := $(shell [ ${APACHE_VERSION} = '2.4' ] && echo '/var/ww
 #apache
 #FREESIDE_DOCUMENT_ROOT = /usr/local/apache/htdocs/freeside
 
+POD2HTML_DIR = ${FREESIDE_DOCUMENT_ROOT}/docs/library
+
 #deb, redhat, fedora, mandrake, suse, others?
 INIT_FILE = /etc/init.d/freeside
 #freebsd
@@ -328,7 +330,13 @@ install-chown:
 	chown freeside "${FREESIDE_CACHE}/cache.${DATASOURCE}"
 	chown freeside "${FREESIDE_EXPORT}/export.${DATASOURCE}"
 
-install: install-perl-modules install-docs install-init install-apache install-rt install-torrus install-texmf install-chown
+install-pod2html:
+	echo "${POD2HTML_DIR}"
+	mkdir -p "${POD2HTML_DIR}"
+	perl bin/pod2html.pl "${POD2HTML_DIR}"
+	chown freeside:freeside -R "${POD2HTML_DIR}"
+
+install: install-perl-modules install-docs install-init install-apache install-rt install-torrus install-texmf install-chown install-pod2html
 
 deploy: install
 	${HTTPD_RESTART}
diff --git a/bin/pod2html.pl b/bin/pod2html.pl
new file mode 100755
index 000000000..935ff1198
--- /dev/null
+++ b/bin/pod2html.pl
@@ -0,0 +1,114 @@
+#!/usr/bin/env perl
+
+=head1 NAME
+
+pod2html.pl
+
+=head1 DESCRIPTION
+
+Generate HTML from POD documentation
+
+Search directories /usr/local/share/perl and /usr/local/bin
+
+Output HTML to /var/www/html/freeside-doc
+
+=cut
+
+use strict;
+use warnings;
+use v5.10;
+
+use Pod::Simple::Search;
+use Pod::Simple::HTML;
+use Pod::Simple::HTMLBatch;
+
+# Disable this to only build docs for Freeside modules
+# This will cause links to non-freeside packages to be broken,
+# but save 30-60secs during build process
+my $include_system_perl_modules = 1;
+
+
+my $html_dir = shift @ARGV
+  or HELP_MESSAGE('Please specify an OUTPUT_DIRECTORY');
+
+HELP_MESSAGE("Directory $html_dir: No write access!")
+  unless -w $html_dir;
+
+
+my $parser = Pod::Simple::HTMLBatch->new;
+
+# Uncomment to suppress status output to STDIN
+# $parser->verbose(0);
+
+$parser->search_class('Inline::Pod::Simple::Search');
+$parser->html_render_class('Inline::Pod::Simple::HTML');
+
+# Customized HTML output
+our $html_before_title = q{
+  <% include( '/elements/header.html', 'Developer Documentation' ) %>
+  <& /elements/menubar.html,
+    'Freeside Perl Modules' => $fsurl.'docs/library/FS.html',
+    'Complete Index' => $fsurl.'docs/library/index.html',
+  &>
+
+  <div style="width: 90%; margin: 1em auto; font-size: .9em; border: solid 1px #666; background-color: #eee; padding: 1em;">
+  <h1 style="margin: .5em; border-bottom: solid 1px #999;">
+};
+our $html_after_title = q{</h1>};
+our $html_footer = q{</div><% include ('/elements/footer.html' ) %>};
+
+$parser->contents_page_start(
+  "$html_before_title Freeside Documentation Index $html_after_title"
+);
+$parser->contents_page_end( $html_footer );
+
+my @search_dirs = (
+  '/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',
+  ) : (),
+);
+
+$parser->batch_convert( \@search_dirs, $html_dir );
+
+sub HELP_MESSAGE {
+  my $error = shift;
+  print " ERROR: $error \n"
+    if $error;
+  print "
+    Tool to generate HTML from Freeside POD documentation
+
+    Usage: pod2html.pl OUTPUT_DIRECTORY
+
+  ";
+  exit;
+}
+
+
+
+# Subclass Pod::Simple::Search to render POD from files without
+# normal perl extensions like PL and PM
+package Inline::Pod::Simple::Search;
+use base 'Pod::Simple::Search';
+
+sub new {
+  my $class = shift;
+  my $self = Pod::Simple::Search->new( @_ );
+  $self->laborious(1);
+  $self;
+}
+1;
+
+
+# Subclass Pod::Simple::HTML to control HTML output
+package Inline::Pod::Simple::HTML;
+use base 'Pod::Simple::HTML';
+
+sub html_header_before_title { $html_before_title }
+sub html_header_after_title { $html_after_title }
+sub html_footer { $html_footer }
+
+1;
diff --git a/debian/control b/debian/control
index 69577ba87..8db053b4d 100644
--- a/debian/control
+++ b/debian/control
@@ -102,7 +102,7 @@ Depends: aspell-en,gnupg,ghostscript,gsfonts,gzip,latex-xcolor,
  libgeo-streetaddress-us-perl, libbusiness-onlinepayment-perl,
  libnet-vitelity-perl (>= 0.05), libnet-sslglue-perl, libexpect-perl,
  libspreadsheet-parsexlsx-perl, libunicode-truncate-perl (>= 0.303-1),
- libspreadsheet-xlsx-perl
+ libspreadsheet-xlsx-perl, libpod-simple-perl
 Conflicts: libparams-classify-perl (>= 0.013-6)
 Replaces: freeside (<<4)
 Breaks: freeside (<<4)
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index 009f38084..b04153fe9 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -934,6 +934,7 @@ if ( $agentnum ) {
     if $conf->config('ticket_system') eq 'RT_Internal';
   $help_menu{'Networking monitoring documentation'} = [ 'http://torrus.org/userguide.pod.html', 'Torrus User Guide' ]
     if $conf->config('network_monitoring_system') eq 'Torrus_Internal';
+  $help_menu{'Developer documentation'} = [ "${fsurl}docs/library/FS.html", 'Developer documentation' ];
   $help_menu{'separator'} = '';
   $help_menu{"About Freeside v$FS::VERSION"} = [ "javascript:about_freeside()", '' ];
   $help_menu{"About RT v$RT::VERSION"} = [ 'http://www.bestpractical.com/rt', 'Request Tracker Homepage' ]

-----------------------------------------------------------------------

Summary of changes:
 Makefile                      |  10 +++-
 bin/pod2html.pl               | 114 ++++++++++++++++++++++++++++++++++++++++++
 debian/control                |   2 +-
 httemplate/elements/menu.html |   1 +
 4 files changed, 125 insertions(+), 2 deletions(-)
 create mode 100755 bin/pod2html.pl




More information about the freeside-commits mailing list