X-Git-Url: https://git.exim.org/exim-website.git/blobdiff_plain/f6fb1b4edc6b165cf5e84ce56a7a2efa8e6dc51b..3ad9ed8279e322dc4b2d36152b518387e324ddb9:/script/gen.pl 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(