]> sipb.mit.edu Git - ikiwiki.git/commitdiff
example script
authorJon Dowland <jon@ncl.ac.uk>
Thu, 2 Apr 2009 15:15:41 +0000 (16:15 +0100)
committerJon Dowland <jon@ncl.ac.uk>
Thu, 2 Apr 2009 15:15:41 +0000 (16:15 +0100)
doc/forum/How_does_ikiwiki_remember_times__63__.mdwn

index 0e771cd0d26427711f2f9e1a52c9bd07e3810686..3da37f3d4313688ffa26bd3042d1bfd785f91fa6 100644 (file)
@@ -58,3 +58,31 @@ Do I have it right?
 > > > > normally lose the times also. (And in that case I think both times are irretrievable, even by 
 > > > > `--getctime`). I might start using a simple script to make blog posts that creates a file for
 > > > > me, puts today's date in the file as a meta, and opens the file in my editor.  -- [[seanh]]
+
+>>>>> I use a script that does that and also sets up templates and tags
+>>>>> for a new item:
+
+    #!/bin/sh
+    set -u
+    set -e
+
+    if [ $# -ne 1 ]; then
+        echo usage: $0 pagename >&2
+        exit 1
+    fi
+
+    pagename="$1"
+
+    if [ -e "$pagename" ]; then
+        echo error: "$pagename" exists >&2
+            exit 1
+    fi
+
+    date=$(date)
+    echo '[[!template id=draft]]' >> "$pagename"
+    echo "[[!meta date=\"$date\"]]" >> "$pagename"
+    echo "[[!tag draft]]" >> "$pagename"
+    git add "$pagename"
+    $EDITOR "$pagename"
+
+>>>>> -- [[Jon]]