rev 1359 - in trunk/mariachi: lib templates

[prev] [thread] [next] [lurker] [Date index for 2003/08/20]

From: richardc
Subject: rev 1359 - in trunk/mariachi: lib templates
Date: 12:04 on 20 Aug 2003
Author: richardc
Date: 2003-08-20 12:04:42 +0100 (Wed, 20 Aug 2003)
New Revision: 1359

Modified:
   trunk/mariachi/lib/Mariachi.pm
   trunk/mariachi/templates/pagenav.tt2
   trunk/mariachi/templates/paginate.tt2
Log:
make nthpage a method on the mariachi class (will help hates-software.com)

Modified: trunk/mariachi/lib/Mariachi.pm
===================================================================
--- trunk/mariachi/lib/Mariachi.pm	2003-08-17 11:37:12 UTC (rev 1358)
+++ trunk/mariachi/lib/Mariachi.pm	2003-08-20 11:04:42 UTC (rev 1359)
@@ -375,6 +375,16 @@
 
 =cut
 
+sub nthpage {
+    my $self = shift;
+    my $n    = shift;
+    my $page = shift;
+    return $page if $n == 1;
+    --$n;
+    $page =~ s/\./_$n./;
+    return $page;
+}
+
 sub generate_pages {
     my $self = shift;
     my $template = shift;
@@ -387,17 +397,10 @@
             $template,
             { @_,
               mariachi  => $self,
+              spool     => $spool,
               # callbacktastic
               again     => sub { $again },
               file      => sub { $file  },
-              nthpage   => sub {
-                  my $n    = shift;
-                  my $page = $spool;
-                  return $page if $n == 1;
-                  --$n;
-                  $page =~ s/\./_$n./;
-                  return $page;
-              },
               set_again => sub { $again = shift; return },
               set_file  => sub { $file  = shift; return }, },
             $self->config->output . "/$$.tmp" )
@@ -430,7 +433,7 @@
 }
 
 
-=head2 ->generate_thread_index
+=head2 ->generate_thread
 
 =cut
 

Modified: trunk/mariachi/templates/pagenav.tt2
===================================================================
--- trunk/mariachi/templates/pagenav.tt2	2003-08-17 11:37:12 UTC (rev 1358)
+++ trunk/mariachi/templates/pagenav.tt2	2003-08-20 11:04:42 UTC (rev 1359)
@@ -1,11 +1,11 @@
 [% IF page.last_page > 1 %]
-<p>[% IF page.previous_page %]<a href="[% base %][% nthpage( page.previous_page ) %]">&lt; mari</a>[% ELSE %]mari[% END %]
+<p>[% IF page.previous_page %]<a href="[% base %][% mariachi.nthpage( page.previous_page, spool ) %]">&lt; mari</a>[% ELSE %]mari[% END %]
 
 [% FOREACH p = [1 .. page.last_page] %]
 [% IF p == page.current_page ; "<b>a</b>"; ELSE %]
-<a href="[% base %][% nthpage( p ) %]">a</a>[% END %]
+<a href="[% base %][% mariachi.nthpage( p, spool ) %]">a</a>[% END %]
 [% END %]
-[% IF page.next_page %]<a href="[% base %][% nthpage( page.next_page ) %]">chi &gt;</a>[% ELSE %]chi[% END %]
+[% IF page.next_page %]<a href="[% base %][% mariachi.nthpage( page.next_page, spool ) %]">chi &gt;</a>[% ELSE %]chi[% END %]
 <br />[ Page [% page.current_page %] of [% page.last_page %] ]
 </p>
 [% END %]

Modified: trunk/mariachi/templates/paginate.tt2
===================================================================
--- trunk/mariachi/templates/paginate.tt2	2003-08-17 11:37:12 UTC (rev 1358)
+++ trunk/mariachi/templates/paginate.tt2	2003-08-20 11:04:42 UTC (rev 1359)
@@ -6,4 +6,4 @@
    ELSE ; 
 	set_again(nextpage) ; 
    END %]
-[% set_file( nthpage( thispage ) ) %]
+[% set_file( mariachi.nthpage( thispage, spool ) ) %]

Generated at 13:57 on 01 Jul 2004 by mariachi 0.52