[Rt-commit] rt branch, 4.0/static-docs, updated. rt-4.0.6-315-g03339d5
Jim Brandt
jbrandt at bestpractical.com
Fri Aug 31 15:46:09 EDT 2012
The branch, 4.0/static-docs has been updated
via 03339d5d3da499c8a3ac84db0700c9a3f61409a8 (commit)
from 7f9b93f74bb99efeef11f64a37117928a4f775ac (commit)
Summary of changes:
devel/tools/rt-static-docs | 26 ++++++-
lib/RT/Pod/Simple/HTMLBatch.pm | 151 +++++++++++++++++++++++++----------------
2 files changed, 117 insertions(+), 60 deletions(-)
- Log -----------------------------------------------------------------
commit 03339d5d3da499c8a3ac84db0700c9a3f61409a8
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Fri Aug 31 15:23:38 2012 -0400
Modify generated docs for inclusion in bps site
Remove all header HTML, modify 'back to index' links,
add etc to get RT_Config.pm docs.
diff --git a/devel/tools/rt-static-docs b/devel/tools/rt-static-docs
index 4eb027d..95947c9 100755
--- a/devel/tools/rt-static-docs
+++ b/devel/tools/rt-static-docs
@@ -55,7 +55,8 @@ use File::Basename 'basename';
use RT::Pod::Simple::HTMLBatch;
my %opts;
-GetOptions( \%opts, "help|h", 'rt-root=s', 'to=s' );
+my $print_header = '';
+GetOptions( \%opts, "help|h", 'rt-root=s', 'to=s', 'print_header' );
if ( $opts{'help'} ) {
require Pod::Usage;
@@ -73,11 +74,12 @@ if ( $opts{'rt-root'} ) {
chdir $opts{'rt-root'};
}
-my @dirs = ( 'docs', 'lib', 'bin', 'sbin' );
+my @dirs = ( 'docs', 'lib', 'bin', 'sbin', 'etc' );
my $batch = RT::Pod::Simple::HTMLBatch->new;
$batch->css_flurry(0);
-$batch->add_css('rt-docs.css');
+$batch->javascript_flurry(0);
+#$batch->add_css('rt-docs.css');
my $contents_page_start =<<START;
<html>
@@ -88,6 +90,8 @@ my $contents_page_start =<<START;
<h1>RT Documentation</h1>
START
+$contents_page_start = '' unless $print_header;
+
$batch->contents_page_start($contents_page_start);
$batch->contents_page_end('');
$batch->batch_convert( join( ':', @dirs ), $opts{to} );
@@ -108,3 +112,19 @@ rt-static-docs - generate doc shipped with RT
This script is used to generate documents shipped with RT.
+=head1 OPTIONS
+
+=over
+
+=item --to
+
+Set the destination directory for the output files.
+
+=item --print_header
+
+Flag to printer HTML page header on the TOC page. This only effects
+the TOC page. It defaults to off.
+
+=back
+
+=cut
diff --git a/lib/RT/Pod/Simple/HTMLBatch.pm b/lib/RT/Pod/Simple/HTMLBatch.pm
index a72e9c3..f03b38a 100644
--- a/lib/RT/Pod/Simple/HTMLBatch.pm
+++ b/lib/RT/Pod/Simple/HTMLBatch.pm
@@ -1,57 +1,11 @@
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
-# <sales at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-
package RT::Pod::Simple::HTMLBatch;
use base Pod::Simple::HTMLBatch;
-=over
+=head2 modnames2paths
+
+Override
-Override to set some different options in the Pod::Simple::Search
+Set some different options in the Pod::Simple::Search
object. Probably would be better if Pod::Simple::HTMLBatch
just took a prepped object as an optional param.
@@ -91,7 +45,9 @@ sub modnames2paths { # return a hashref mapping modulenames => paths
return $m2p;
}
-=over
+=head2 _prep_contents_breakdown
+
+Override
Modified to create hash entries for the documentation sections
we want based on where they came from. These entries can then
@@ -112,7 +68,7 @@ sub _prep_contents_breakdown {
# First, look for specific sections we want docs for and create entries
# for them.
- if ( $entry->[1] =~ /\/docs\// ) {
+ if ( $entry->[1] =~ /(\/docs\/|\/etc\/)/ ) {
$toplevel = "RT User Documentation";
++$toplevel_form_freq{'user_docs'}{$toplevel};
push @{ $toplevel{'user_docs'} }, $entry;
@@ -170,7 +126,9 @@ sub _prep_contents_breakdown {
return \%toplevel;
}
-=over
+=head2 _write_contents_middle
+
+Override
Add more control over the order of sections in the TOC file.
@@ -179,7 +137,7 @@ Add more control over the order of sections in the TOC file.
sub _write_contents_middle {
my($self, $Contents, $outfile, $toplevel2submodules, $toplevel_form_freq) = @_;
- $self->format_link_text($toplevel2submodules->{user_docs});
+ $self->format_toc_link_text($toplevel2submodules->{user_docs});
# Build the sections of the TOC in the order we want
my @toc_sections = qw(user_docs bin_docs sbin_docs dev_docs action_docs condition_docs);
@@ -189,7 +147,9 @@ sub _write_contents_middle {
}
}
-=over
+=head2 _write_content_subsection
+
+Override
Remove the outer loop since we are calling each section deliberately in the
order we want. Still use the main logic to write the content of inner sections.
@@ -217,13 +177,90 @@ sub _write_content_subsection {
return 1;
}
-=head2 format_link_text
+=head2 batch_mode_page_object_init
+
+Override
+
+Change init options for the Pod::Simple::HTML object that writes out the
+pages.
+
+=cut
+
+sub batch_mode_page_object_init {
+ my $self = shift;
+ my($page, $module, $infile, $outfile, $depth) = @_;
+
+ $page->default_title('');
+ $page->force_title(''); # Force the title off.
+ $page->index( $self->index );
+
+ $page->html_header_before_title('');
+ $page->html_header_after_title('');
+ $page->html_footer('');
+ $page->html_css( $self-> _css_wad_to_markup($depth) );
+ $page->html_javascript( $self->_javascript_wad_to_markup($depth) );
+
+ $self->add_header_backlink($page, $module, $infile, $outfile, $depth);
+ $self->add_footer_backlink($page, $module, $infile, $outfile, $depth);
+
+ return $self;
+}
+
+=head2 add_header_backlink
+
+Override
+
+Update backlink in header
+
+=cut
+
+sub add_header_backlink {
+ my $self = shift;
+ return if $self->no_contents_links;
+ my($page, $module, $infile, $outfile, $depth) = @_;
+ $page->html_header_after_title( join '',
+ $page->html_header_after_title || '',
+
+ qq[<p class="backlinktop"><b><a name="___top" href="],
+ $self->url_up_to_contents($depth),
+ qq[" accesskey="1" title="All Documents">Back to Index</a></b></p>\n],
+ )
+ if $self->contents_file
+ ;
+ return;
+}
+
+=head2 add_footer_backlink
+
+Override
+
+Update backlink in footer
+
+=cut
+
+sub add_footer_backlink {
+ my $self = shift;
+ return if $self->no_contents_links;
+ my($page, $module, $infile, $outfile, $depth) = @_;
+ $page->html_footer( join '',
+ qq[<p class="backlinkbottom"><b><a name="___bottom" href="],
+ $self->url_up_to_contents($depth),
+ qq[" title="All Documents">Back to Index</a></b></p>\n],
+
+ $page->html_footer || '',
+ )
+ if $self->contents_file
+ ;
+ return;
+}
+
+=head2 format_toc_link_text
Apply some formatting to the visible links for user documentation.
=cut
-sub format_link_text {
+sub format_toc_link_text {
my ($self, $content) = @_;
foreach my $entry ( @{$content} ){
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list