[svn:parrot] r48128 - in branches/html_cleanup: lib/Parrot/Docs tools/docs
coke at svn.parrot.org
coke at svn.parrot.org
Tue Jul 20 16:54:25 UTC 2010
Author: coke
Date: Tue Jul 20 16:54:24 2010
New Revision: 48128
URL: https://trac.parrot.org/parrot/changeset/48128
Log:
track breadcrumbs for non-trivial case
Modified:
branches/html_cleanup/lib/Parrot/Docs/PodToHtml.pm
branches/html_cleanup/tools/docs/make_html_docs.pl
Modified: branches/html_cleanup/lib/Parrot/Docs/PodToHtml.pm
==============================================================================
--- branches/html_cleanup/lib/Parrot/Docs/PodToHtml.pm Tue Jul 20 16:34:12 2010 (r48127)
+++ branches/html_cleanup/lib/Parrot/Docs/PodToHtml.pm Tue Jul 20 16:54:24 2010 (r48128)
@@ -54,6 +54,24 @@
return $new;
}
+=item C<set_parent()>
+
+Store information about the referring page so we can generate breadcrumbs.
+
+=cut
+
+sub set_parent {
+ my $self = shift;
+ my $parent = shift;
+ my $parent_title = shift;
+
+ return if $parent eq 'index'; # this is the root, no need to track it 2x.
+
+ $self->{parent} = $parent;
+ $self->{parent_title} = $parent_title;
+}
+
+
=item C<do_beginning()>
Reimplements the C<Pod::Simple::HTML> method to add a header to the start
@@ -85,6 +103,10 @@
my $docroot = join('/', (('..') x ++$dirCount)) ;
my $resources_URL = $docroot . '/resources';
my $nav_HTML = qq{<a href="$docroot/html/index.html">Home</a>};
+ if (exists $self->{parent}) {
+ $nav_HTML .= qq{ » <a href="$docroot/html/} . $self->{parent};
+ $nav_HTML .= qq{.html">} . $self->{parent_title} . '</a>';
+ }
print { $self->{'output_fh'} }
Parrot::Docs::HTMLPage->header(
@@ -747,6 +769,8 @@
have been copied here, and then refactored and adjusted to enable various bits
of Parrot-specific behaviour.
+At least, that's what POD2HTML, the original version of this file, said.
+
=cut
1;
Modified: branches/html_cleanup/tools/docs/make_html_docs.pl
==============================================================================
--- branches/html_cleanup/tools/docs/make_html_docs.pl Tue Jul 20 16:34:12 2010 (r48127)
+++ branches/html_cleanup/tools/docs/make_html_docs.pl Tue Jul 20 16:54:24 2010 (r48128)
@@ -50,7 +50,7 @@
foreach my $index_file (@json_index_files) {
my $contents;
open my $fh, '<', $index_file;
- { local $/; $contents = <$fh>}
+ { local $/; $contents = <$fh> }
my $section = '';
eval {
$section = $json->decode($contents);
@@ -102,7 +102,7 @@
}
}
else {
- transform_input($source);
+ transform_input($source, $page->{page}, $page->{title});
}
}
}
@@ -110,13 +110,15 @@
my %generated;
sub transform_input {
- my $input = shift;
+ my ($input, $parent, $parent_title) = @_;
+
if (! -f $input) {
die "$input not found or not a regular file\n" .
"You might need to restrict your glob specification.";
}
my $formatter = Parrot::Docs::PodToHtml->new();
+ $formatter->set_parent($parent, $parent_title);
# Errata is currently noisy; e.g. complains about U<> even after
# formatting it as expected. skip it until we can properly quiet it down.
More information about the parrot-commits
mailing list