[exim-cvs] Don't display a "Next" link when we get to the la…

Top Pagina
Delete this message
Reply to this message
Auteur: Exim Git Commits Mailing List
Datum:  
Aan: exim-cvs
Onderwerp: [exim-cvs] Don't display a "Next" link when we get to the last page in the
Gitweb: http://git.exim.org/exim-website.git/commitdiff/3ad9ed8279e322dc4b2d36152b518387e324ddb9
Commit:     3ad9ed8279e322dc4b2d36152b518387e324ddb9
Parent:     f6fb1b4edc6b165cf5e84ce56a7a2efa8e6dc51b
Author:     Mike Cardwell <github@???>
AuthorDate: Wed Sep 7 09:48:39 2011 +0100
Committer:  Mike Cardwell <github@???>
CommitDate: Wed Sep 7 09:48:39 2011 +0100


    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 <chapter_id>N</chapter_id> 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 @@


          <!-- Navigation -->
          <a class="previous_page" href="{prev_url}"><![CDATA[<-previous]]></a>
-         <a class="next_page"     href="{next_url}"><![CDATA[next->]]></a>
+     <xsl:if test="next_url">
+            <a class="next_page" href="{next_url}"><![CDATA[next->]]></a>
+         </xsl:if>


          <!-- Chapter Wrapper -->
          <div id="chapter" class="chapter{@class}">