changeset 18:c1e8ae6c878d

2007-08-14 18:10:18 by steve Minor comment updates.
author steve
date Tue, 14 Aug 2007 18:10:18 +0000
parents d8a5506ec11b
children 8af29bfa35b0
files bin/chronicle
diffstat 1 files changed, 53 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/bin/chronicle	Tue Aug 14 17:58:46 2007 +0000
+++ b/bin/chronicle	Tue Aug 14 18:10:18 2007 +0000
@@ -54,7 +54,7 @@
  --
  http://www.steve.org.uk/
 
- $Id: chronicle,v 1.8 2007-08-14 17:58:18 steve Exp $
+ $Id: chronicle,v 1.9 2007-08-14 18:10:18 steve Exp $
 
 =cut
 
@@ -90,6 +90,8 @@
 
 
 
+
+
 #
 #  Setup default options.
 #
@@ -119,12 +121,6 @@
     system($CONFIG{'pre-build'});
 }
 
-#
-#  Make sure our output directory exists.
-#
-mkpath( $CONFIG{'output'}, 0, 0755 ) if ( ! -d $CONFIG{'output'} );
-
-
 
 #
 #  Parse each of the given text files, and build up a datastructure
@@ -141,8 +137,9 @@
 #
 my %data = createDataStructure();
 
+
 #
-#  Find each unique tag which is used within our text.
+#  Find each unique tag used within our entries.
 #
 my %all_tags;
 %all_tags = findAllTags() unless( $CONFIG{'no-tags'} );
@@ -164,6 +161,13 @@
 $CLOUD{'archive'} = createDateCloud( %all_dates ) unless( $CONFIG{'no-archive'} );;
 
 
+
+#
+#  Make sure our output directory exists.
+#
+mkpath( $CONFIG{'output'}, 0, 0755 ) if ( ! -d $CONFIG{'output'} );
+
+
 #
 #  Output each static page.
 #
@@ -176,7 +180,7 @@
 
 
 #
-#  Build an output page for each tag which we've discovered.
+#  Build an output page for each tag which has ever been used.
 #
 foreach my $tagName ( sort keys %all_tags )
 {
@@ -200,7 +204,7 @@
 
 
 #
-#  Now output the most recent entries for our front-page.
+#  Finally out the most recent entries for the front-page.
 #
 outputIndexPage();
 
@@ -222,6 +226,7 @@
     system($CONFIG{'post-build'});
 }
 
+
 #
 #  All done.
 #
@@ -231,6 +236,8 @@
 
 
 
+
+
 =begin doc
 
   Setup the default options we'd expect into our global configuration hash.
@@ -241,19 +248,47 @@
 
 sub setupDefaultOptions
 {
+    #
+    #  Text directory.
+    #
     $CONFIG{'input'}      = "./blog";
+
+    #
+    #  Output directory.
+    #
     $CONFIG{'output'}     = "./output";
+
+    #
+    #  Theme directory.
+    #
     $CONFIG{'template'}   = "./themes/default";
+
+    #
+    #  prefix for all links.
+    #
     $CONFIG{'url-prefix'} = "";
+
+    #
+    #  Default input format
+    #
     $CONFIG{'format'}     = 'html';
+
+    #
+    #  Entries per-page for the index.
+    #
+    $CONFIG{'entry-count'} = 10;
+
 }
 
 
 
+
 =begin doc
 
   Parse the command line arguments this script was given.
 
+  TODO:  Document these in the POD.
+
 =end doc
 
 =cut
@@ -295,7 +330,7 @@
 
     if ( $VERSION )
     {
-        my $REVISION      = '$Revision: 1.8 $';
+        my $REVISION      = '$Revision: 1.9 $';
         if ( $REVISION =~ /1.([0-9.]+) / )
         {
             $REVISION = $1;
@@ -352,7 +387,6 @@
         #
         next if ( -d $file );
 
-
         my $title   = '';
         my $date    = '';
         my $private = 0;
@@ -738,7 +772,7 @@
     #
     #  The number of entries to display upon the index.
     #
-    my $max = $CONFIG{'entry-count'} || 10;
+    my $max = $CONFIG{'entry-count'};
     foreach my $f ( @tmp2 )
     {
         push( @$entries, $f ) if ( $max > 0 );
@@ -994,7 +1028,6 @@
     #
     my $template = loadTemplate( "entry.template" );
 
-
     #
     #  Just the name of the file.
     #
@@ -1050,11 +1083,11 @@
     my %entry;
 
 
-    my $title  = "";
-    my $tags   = "";
-    my $body   = "";
-    my $date   = "";
-    my $status = "";
+    my $title  = "";   # entry title.
+    my $tags   = "";   # entry tags.
+    my $body   = "";   # entry body.
+    my $date   = "";   # entry date
+    my $status = "";   # entry privacy/security.
 
 
     open( ENTRY, "<", $filename ) or die "Failed to read $filename $!";
@@ -1111,7 +1144,7 @@
     }
     else
     {
-        print "Unkown blog entry format.  Leaving text as raw\n";
+        print "Unkown blog entry format ($CONFIG{'format'}).  Treating as HTML.\n";
     }
 
     #