From 3ad9ed8279e322dc4b2d36152b518387e324ddb9 Mon Sep 17 00:00:00 2001 From: Mike Cardwell Date: Wed, 7 Sep 2011 09:48:39 +0100 Subject: [PATCH] Don't display a "Next" link when we get to the last page in the documentation --- script/gen.pl | 5 +++-- templates/doc/chapter.xsl | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/script/gen.pl b/script/gen.pl index 217fdd4..ac3d3d6 100755 --- a/script/gen.pl +++ b/script/gen.pl @@ -131,7 +131,8 @@ sub do_doc { ## Generate the chapters my $counter = 0; - foreach my $chapter ( map { $_->cloneNode(1) } $xml->findnodes('/book/chapter') ) { + my @chapters = map { $_->cloneNode(1) } $xml->findnodes('/book/chapter'); + foreach my $chapter ( @chapters ) { ## Add a N node for the stylesheet to use $chapter->appendTextChild( 'chapter_id', ++$counter ); @@ -144,7 +145,7 @@ sub do_doc { ? 'filter.html' : 'index.html' : sprintf( '%sch%02d.html', $prepend_chapter, $counter - 1 ) ); - $chapter->appendTextChild( 'next_url', sprintf( '%sch%02d.html', $prepend_chapter, $counter + 1 ) ); + $chapter->appendTextChild( 'next_url', sprintf( '%sch%02d.html', $prepend_chapter, $counter + 1 ) ) unless int(@chapters) == $counter; $chapter->appendTextChild( 'canonical_url', sprintf( diff --git a/templates/doc/chapter.xsl b/templates/doc/chapter.xsl index dd5d06a..6fd6d8c 100644 --- a/templates/doc/chapter.xsl +++ b/templates/doc/chapter.xsl @@ -41,7 +41,9 @@ - ]]> + + ]]> +
-- 2.30.2