080515postahead

Subject: Posting Ahead Tags: life, software, web Date: Thu, 15 May 2008 09:52:52 +0100 Publish: 15 May 2008

I'm convinced by The Argument for Posting Ahead [Network Blogging] so why didn't I set it up for my recent trip?

Well, a while ago, I had a bit of an email discussion with Steve about delayed posting features for Chronicle which I think ended with the addition of chronicle-spooler to the released files. I initially suggested ignoring a post when its Date is in the future, like Wordpress does, but I think that wouldn't be backwards-compatible and isn't as flexibile as it could be.

chronicle-spooler works by moving files from a spool dir into a live dir. I'd forgotten how much it confuses me when files on a "static" site start moving themselves around. It means I have to merge before upload, which isn't a big change, but still annoying.

So, I've added the following lines to chronicle to skip entries with a Publish header in the future:-

--- chronicle-2.7/bin/chronicle.orig    2008-05-15 10:13:55.000000000 +0100
+++ chronicle-2.7/bin/chronicle 2008-05-15 10:13:43.000000000 +0100
@@ -607,7 +607,8 @@
         #  Read the entry and store all the data away as a
         # hash element keyed upon the (unique) filename.
         #
-        $results{ $file } = readBlogEntry($file);
+        my $result =  readBlogEntry($file);
+        if ($result) { $results{ $file } = $result; }
     }

     #
@@ -1479,7 +1480,7 @@
     my $tags    = "";    # entry tags.
     my $body    = "";    # entry body.
     my $date    = "";    # entry date
-    my $publish = "";    # entry publish date - *ignored*

+    my $publish = "";    # entry publish date

     open( ENTRY, "<", $filename ) or die "Failed to read $filename $!";
     while ( my $line = <ENTRY> )
@@ -1527,6 +1528,14 @@
     }
     close(ENTRY);

+    # MJR - embargo stuff until its publish date.
+    # Steve recommends using chronicle-spooler,
+    # but I want uploaded files to stay where I put them,
+    # else I get my local copy confused.
+    if (($publish ne "") && (str2time($publish) > time())) {
+       return 0;
+    }
+
     #
     #  Determine the input format to use.
     #

I think that's compatible with chronicle-spooler, too...