From: Mike Cardwell Date: Wed, 7 Sep 2011 08:48:39 +0000 (+0100) Subject: Don't display a "Next" link when we get to the last page in the X-Git-Tag: exim-4_89_1~58^2 X-Git-Url: https://git.exim.org/exim-website.git/commitdiff_plain/3ad9ed8279e322dc4b2d36152b518387e324ddb9?ds=sidebyside Don't display a "Next" link when we get to the last page in the documentation --- 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 @@ - ]]> + + ]]> +