[Catalyst-commits] r7116 - in branches/site-notrac/podbuilder: . root root/docs

jshirley at dev.catalyst.perl.org jshirley at dev.catalyst.perl.org
Fri Nov 9 23:21:48 GMT 2007


Author: jshirley
Date: 2007-11-09 23:21:47 +0000 (Fri, 09 Nov 2007)
New Revision: 7116

Added:
   branches/site-notrac/podbuilder/root/render_pod.tt
Removed:
   branches/site-notrac/podbuilder/root/sample.tt
Modified:
   branches/site-notrac/podbuilder/buildtree.pl
   branches/site-notrac/podbuilder/cat_toc.yml
   branches/site-notrac/podbuilder/root/docs/page_nav.tt
   branches/site-notrac/podbuilder/root/docs/toc.tt
   branches/site-notrac/podbuilder/root/docs/view.tt
   branches/site-notrac/podbuilder/root/docs/wrapper.tt
Log:
Improved rendering, a bit of cleanup and generally going the right direction.

Modified: branches/site-notrac/podbuilder/buildtree.pl
===================================================================
--- branches/site-notrac/podbuilder/buildtree.pl	2007-11-09 18:07:34 UTC (rev 7115)
+++ branches/site-notrac/podbuilder/buildtree.pl	2007-11-09 23:21:47 UTC (rev 7116)
@@ -116,6 +116,15 @@
                 $data->{children}->[$i]->{next} = $data->{children}->[$i+1]
                     if $data->{children}->[$i + 1];
             }
+            # We don't have source, but we have children.  This is just a 
+            # summary page.  This will load the first paragraph from each
+            # of the children and generate a page.  We just have to populate
+            # the filename now.  Second iteration generates the page.
+            if ( not $data->{source} and $data->{title} ) {
+                my $filename = $data->{title};
+                $filename =~ s/[^A-Za-z0-9_]/_/g;
+                $data->{filename} = "$filename.html";
+            }
         }
 
         if ( $data->{default_children} ) {
@@ -130,8 +139,9 @@
     map { { source => $_ } }
     grep { !exists $pod_list{$_} }
     keys %name2path;
-%pod_list = %pod_list, %name2path;
 
+%pod_list = ( %pod_list, %name2path );
+
 $tree = $visitor->visit( $tree );
 
 my $template = Template->new({
@@ -180,7 +190,7 @@
 
         my $fh = file("$dir/$filename")->open('w');
         $template->process(
-            "sample.tt",
+            "render_pod.tt",
             $stash,
             $fh
         ) or die
@@ -188,6 +198,24 @@
             $template->error;
         $fh->close;
     }
+    # Summary Page
+    elsif ( my $filename = $node->{filename} ) {
+        my $stash = $node;
+        my $fh = file("$dir/$filename")->open('w');
+        $template->process(
+            "summary_page.tt",
+            {
+                parent_stack => [ map { $_->{title} } @parents ],
+                tree         => $tree,
+                render_link  => \&render_link,
+                %{ $node }
+            },
+            $fh
+        ) or die
+            "Unable to generate manual page for $node->{title}: " .
+            $template->error;
+        $fh->close;
+    }
 }
 
 sub render_link {

Modified: branches/site-notrac/podbuilder/cat_toc.yml
===================================================================
--- branches/site-notrac/podbuilder/cat_toc.yml	2007-11-09 18:07:34 UTC (rev 7115)
+++ branches/site-notrac/podbuilder/cat_toc.yml	2007-11-09 23:21:47 UTC (rev 7116)
@@ -7,85 +7,87 @@
     - /home/jshirley/workarea/perl/Catalyst/examples
 
 tree:
-    - title: Catalyst Manual
+    - title: Manual
       source:  Catalyst::Manual::Intro
       children:
-        - title: Catalyst Tutorial
+        - title: Guided Tutorial
           source: Catalyst::Manual::Tutorial
           children:
-            - title:  "Tutorial: Part 1 - Introduction"
+            - title:  "Part 1 - Introduction"
               source: Catalyst::Manual::Tutorial::Intro
-            - title: "Tutorial: Part 2 - Catalyst Basics"
+            - title: "Part 2 - Catalyst Basics"
               source: Catalyst::Manual::Tutorial::CatalystBasics
-            - title: "Tutorial: Part 3 - Basic CRUD"
+            - title: "Part 3 - Basic CRUD"
               source: Catalyst::Manual::Tutorial::BasicCRUD
-            - title: "Tutorial: Part 4 - Authentication"
+            - title: "Part 4 - Authentication"
               source: Catalyst::Manual::Tutorial::Authentication
-            - title: "Tutorial: Part 5 - Authorization"
+            - title: "Part 5 - Authorization"
               source: Catalyst::Manual::Tutorial::Authorization
-            - title: "Tutorial: Part 6 - Debugging"
+            - title: "Part 6 - Debugging"
               source: Catalyst::Manual::Tutorial::Debugging
-            - title: "Tutorial: Part 7 - Testing"
+            - title: "Part 7 - Testing"
               source: Catalyst::Manual::Tutorial::Testing
-            - title: "Tutorial: Part 8 - Advanced CRUD"
+            - title: "Part 8 - Advanced CRUD"
               source: Catalyst::Manual::Tutorial::AdvancedCRUD
-            - title: "Tutorial: Part 9 - Appendices"
+            - title: "Part 9 - Appendices"
               source: Catalyst::Manual::Tutorial::Appendices
-        - title: Catalyst Philosophy
+        - title: Cookbook
+          source:  Catalyst::Manual::Cookbook
+        - title: Philosophy
           source:  Catalyst::Manual::About
-        - title: Catalyst Cookbook
-          source:  Catalyst::Manual::Cookbook
-    - title: Catalyst Advent Calendar
+    - title: Advent Entries
       children:
-            - title: Catalyst and Subversion
+          - title: Advent 2006
+            children:
+            - title: Day 1 - Catalyst and Subversion
               source: "CatalystAdvent/root/2006/1.pod"
-            - title: Handel
+            - title: Day 2 - Handel
               source: "CatalystAdvent/root/2006/2.pod"
-            - title: Layout of a Catalyst Application
+            - title: Day 3 - Layout of a Catalyst Application
               source: "CatalystAdvent/root/2006/3.pod"
-            - title: Catalyst and FastCGI Deployment
+            - title: Day 4 - Catalyst and FastCGI Deployment
               source: "CatalystAdvent/root/2006/4.pod"
-            - title: Taming Legacy Websites with Catalyst and wget
+            - title: Day 5 - Taming Legacy Websites with Catalyst and wget
               source: "CatalystAdvent/root/2006/5.pod"
 # BindLex entry throws a TT processing error, FIXME/TODO
-            #- title: "Catalyst::Controller::BindLex"
+            #- title: "Day 6 - Catalyst::Controller::BindLex"
             #  source: "CatalystAdvent/root/2006/6.pod"
-            - title: Testing with an External Webserver
+            - title: Day 7 - Testing with an External Webserver
               source: "CatalystAdvent/root/2006/7.pod"
-            - title: YouTube Catalyst Application
+            - title: Day 8 - YouTube Catalyst Application
               source: "CatalystAdvent/root/2006/8.pod"
-            - title: "Web Services with Catalyst::Action::REST"
+            - title: "Day 9 - Web Services with Catalyst::Action::REST"
               source: "CatalystAdvent/root/2006/9.pod"
-            - title: "The Chained Dispatch Type"
+            - title: "Day 10 - The Chained Dispatch Type"
               source: "CatalystAdvent/root/2006/10.pod"
-            - title: "Using Catalyst with Log4perl"
+            - title: "Day 11 - Using Catalyst with Log4perl"
               source: "CatalystAdvent/root/2006/11.pod"
-            - title: "Producing PDFs with Template::Latex"
+            - title: "Day 12 - Producing PDFs with Template::Latex"
               source: "CatalystAdvent/root/2006/12.pod"
-            - title: "Adding Custom Headers"
+            - title: "Day 13 - Adding Custom Headers"
               source: "CatalystAdvent/root/2006/13.pod"
-            - title: "Catalyst JobQueue"
+            - title: "Day 14 - Catalyst JobQueue"
               source: "CatalystAdvent/root/2006/14.pod"
-            - title: "Streaming MP3s with Catalyst"
+            - title: "Day 15 - Streaming MP3s with Catalyst"
               source: "CatalystAdvent/root/2006/15.pod"
-            - title: "FastCGI, Second Visit"
+            - title: "Day 16 - FastCGI, Second Visit"
               source: "CatalystAdvent/root/2006/16.pod"
-            - title: "Testing Catalyst Controllers"
+            - title: "Day 17 - Testing Catalyst Controllers"
               source: "CatalystAdvent/root/2006/17.pod"
-            - title: "Catalyst and I18N"
+            - title: "Day 18 - Catalyst and I18N"
               source: "CatalystAdvent/root/2006/18.pod"
-            - title: "HTML::Widget Tricks"
+            - title: "Day 19 - HTML::Widget Tricks"
               source: "CatalystAdvent/root/2006/19.pod"
-            - title: "Catalyst::Plugin::Flavour"
+            - title: "Day 20 - Catalyst::Plugin::Flavour"
               source: "CatalystAdvent/root/2006/20.pod"
 # Same issue - TODO/FIXME later
-#            - title: "Catalyst and Unicode"
+#            - title: "Day 21 - Catalyst and Unicode"
 #              source: "CatalystAdvent/root/2006/21.pod"
-            - title: "LDAP Autocomplete"
+            - title: "Day 22 - LDAP Autocomplete"
               source: "CatalystAdvent/root/2006/22.pod"
-            - title: "Creating a Google Maps Mashup"
+            - title: "Day 23 - Creating a Google Maps Mashup"
               source: "CatalystAdvent/root/2006/23.pod"
-            - title: "The Catalyst Community"
+            - title: "Day 24 - The Catalyst Community"
               source: "CatalystAdvent/root/2006/24.pod"
     - title: Advanced Catalyst Topics
       children:

Modified: branches/site-notrac/podbuilder/root/docs/page_nav.tt
===================================================================
--- branches/site-notrac/podbuilder/root/docs/page_nav.tt	2007-11-09 18:07:34 UTC (rev 7115)
+++ branches/site-notrac/podbuilder/root/docs/page_nav.tt	2007-11-09 23:21:47 UTC (rev 7116)
@@ -1,32 +1,36 @@
-<div class="previous_topic">
-[% IF prev %]
-<a href="[% prev.filename %]">&lsaquo; [% prev.title || prev.source %]</a>
-[% ELSE %]
-&nbsp;
-[% END %]
-</div>
+[%- IF parent || prev || next -%]
+<div class="topic_tree">
+[%
+parent_list = [];
 
-<div class="next_topic">
-[% IF next %]
-<a href="[% next.filename %]">[% next.title || next.source %] &rsaquo;</a>
-[% ELSE %]
-&nbsp;
-[% END %]
-</div>
-
-<div class="topic_tree">
-[% IF parent %]
-    [%
+IF parent;
         p = parent;
         WHILE ( p );
-            %]<a href="[% p.filename %]">[% p.title %]</a> &raquo; [%
+            parent_list.push(p);
             p = p.parent;
         END;
+        FOREACH p IN parent_list.reverse;
+            %]<a href="[% p.filename %]">[% p.title %]</a> &raquo; [%
+        END;
         title;
-    %]
-[% ELSE %]
-&nbsp;
-[% END %]
+ELSE %]&nbsp;[% END %]
 </div>
 
+<div class="prev_next">
+    <div class="previous_topic">
+    [% IF prev %]
+    <a href="[% prev.filename %]">&lsaquo; [% prev.title || prev.source %]</a>
+    [% ELSE %]
+    &nbsp;
+    [% END %]
+    </div>
 
+    <div class="next_topic">
+    [% IF next %]
+    [% IF prev %]<span class="sep">|</span> [% ELSE %] Next: [% END %]<a href="[% next.filename %]">[% next.title || next.source %] &rsaquo;</a>
+    [% ELSE %]
+    &nbsp;
+    [% END %]
+    </div>
+</div>
+[%- END -%]

Modified: branches/site-notrac/podbuilder/root/docs/toc.tt
===================================================================
--- branches/site-notrac/podbuilder/root/docs/toc.tt	2007-11-09 18:07:34 UTC (rev 7115)
+++ branches/site-notrac/podbuilder/root/docs/toc.tt	2007-11-09 23:21:47 UTC (rev 7116)
@@ -1,7 +1,8 @@
 <ul>
 [% FOREACH branch IN tree %] 
     <li>
-        <a href="[% branch.filename %]">
+        <a [% IF filename == branch.filename %] class="active"[% END ~%]
+            href="[% branch.filename %]">
             [% branch.title || branch.source %]
         </a>
     [%

Modified: branches/site-notrac/podbuilder/root/docs/view.tt
===================================================================
--- branches/site-notrac/podbuilder/root/docs/view.tt	2007-11-09 18:07:34 UTC (rev 7115)
+++ branches/site-notrac/podbuilder/root/docs/view.tt	2007-11-09 23:21:47 UTC (rev 7116)
@@ -8,12 +8,22 @@
 
 
     BLOCK head1;
+        %]<a name="[% item.title %]"></a>[%
         SWITCH item.title;
             CASE 'NAME';
                 # If we have a title, disregard name and just keep the override
                 IF !title; title = view.print(item.content); END;
+            CASE 'OVERVIEW';
+                %]<h1 class="overview">Overview</h1>
+                <p class="overview">[% view.print(item.content) %]</p>[%
+            CASE 'DESCRIPTION';
+                %]<h1 class="description">Description</h1>
+                <p class="description">[% view.print(item.content) %]</p>[%
+            CASE 'SYNOPSIS';
+                %]<h1 class="synopsis">Synopsis</h1>
+                <p class="synopsis">[% view.print(item.content) %]</p>[%
             CASE;
-                %]<h1>[% item.title %]</h1>
+                %]<h1>[% item.title FILTER ucfirst %]</h1>
                 <p>[% view.print(item.content) %]</p>[%
         END;
     END;
@@ -39,7 +49,7 @@
     [% BLOCK seq_text; item; END; %]
 
     [% BLOCK seq_code %]
-        <span class="code">[% item %]</span>
+        <span class="code">[% item | html %]</span>
     [% END %]
 
     [% BLOCK seq_bold %]
@@ -61,7 +71,7 @@
     [% END %]
 
     [% BLOCK seq_space %]
-        <span class="code">[% item %]</span>
+        <span class="code">[% item | html %]</span>
     [% END %]
 
     [% BLOCK seq_zero; END; %]
@@ -84,7 +94,7 @@
     [% END %]
 
     [% BLOCK verbatim %]
-        <p class="verbatim">[% item %]</p>
+        <pre class="verbatim">[% item | html %]</pre>
     [% END %]
 
     [% BLOCK list;

Modified: branches/site-notrac/podbuilder/root/docs/wrapper.tt
===================================================================
--- branches/site-notrac/podbuilder/root/docs/wrapper.tt	2007-11-09 18:07:34 UTC (rev 7115)
+++ branches/site-notrac/podbuilder/root/docs/wrapper.tt	2007-11-09 23:21:47 UTC (rev 7116)
@@ -36,11 +36,10 @@
 		        </ul>
 		    </div>
 		    <div id="main">
-		        <div id="crumbtrail">
-                    [% PROCESS "docs/page_nav.tt" %]
-		        </div>
+                [% page_nav = PROCESS "docs/page_nav.tt" %]
+		        [% IF page_nav %]<div class="crumbtrail">[% page_nav %]</div>[% END %]
 				<div class="content fullwidth">
-					<h1>[% title %]</h1>
+					<h1 class="title">[% title %]</h1>
                     <div class="manual_navigator">
                       [% PROCESS "docs/toc.tt", depth = 0 %]
                     </div>

Copied: branches/site-notrac/podbuilder/root/render_pod.tt (from rev 6950, branches/site-notrac/podbuilder/root/sample.tt)
===================================================================
--- branches/site-notrac/podbuilder/root/render_pod.tt	                        (rev 0)
+++ branches/site-notrac/podbuilder/root/render_pod.tt	2007-11-09 23:21:47 UTC (rev 7116)
@@ -0,0 +1,11 @@
+[%
+
+USE Pod;
+
+pom = Pod.parse(pod_path);
+myview.print(pom);
+
+%]
+
+<p class="source">Sourced from: <a href="#">[% pod_path %]</a></p>
+

Deleted: branches/site-notrac/podbuilder/root/sample.tt
===================================================================
--- branches/site-notrac/podbuilder/root/sample.tt	2007-11-09 18:07:34 UTC (rev 7115)
+++ branches/site-notrac/podbuilder/root/sample.tt	2007-11-09 23:21:47 UTC (rev 7116)
@@ -1,11 +0,0 @@
-[%
-
-USE Pod;
-
-pom = Pod.parse(pod_path);
-myview.print(pom);
-
-%]
-
-<p class="source">Sourced from: <a href="#">[% pod_path %]</a></p>
-




More information about the Catalyst-commits mailing list