]> git.quilime.com - plog.git/commitdiff
Fixed up content.sh script
authorGabriel Dunne <gdunne@quilime.com>
Tue, 4 Oct 2011 13:55:47 +0000 (19:25 +0530)
committerGabriel Dunne <gdunne@quilime.com>
Tue, 4 Oct 2011 13:55:47 +0000 (19:25 +0530)
TODO [new file with mode: 0644]
content/journal/2011-08-22_arrive [moved from content/journal/arrive with 100% similarity]
content/journal/2011-10-01_update_for_mom [moved from content/journal/update_for_mom with 100% similarity]
content/journal/2011-10-04_dreams [moved from content/journal/dreams with 79% similarity]
content/photo/2011-09-27_habitat [moved from content/photo/2011_9_27_habitat with 100% similarity]
scripts/content [deleted file]
scripts/content.sh [new file with mode: 0755]

diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..4ec8d0e
--- /dev/null
+++ b/TODO
@@ -0,0 +1,9 @@
+TODO
+
+functional
+- prev/next links accessable from View object
+- generate publish cache
+
+
+nice things
+- highlight categories from index
\ No newline at end of file
similarity index 79%
rename from content/journal/dreams
rename to content/journal/2011-10-04_dreams
index 5df3c9ef9b66196c8269f1a7ddbfda7c888cdf5b..62e1f080273653859ce206654533a876b2799496 100644 (file)
@@ -1,4 +1,4 @@
 title = dreams
-date = Tue Oct  4 12:46:34 IST 2011
+date = Tue, Oct 4 2011, 12:46:34; IST 
 --
 My dreams have been incredibly vivid. probably due to the heat. sleeping at odd hours. been working in the studio most of the day at Vishal's house, so I haven't been going out as much as I would like. It's also incredibly hot outside, averaging about 36 degrees C, which is about 95 F.
\ No newline at end of file
diff --git a/scripts/content b/scripts/content
deleted file mode 100755 (executable)
index bbff300..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-DATE=$(date +%Y"-"%m"-"%d)
-FOLDER=$1
-
-echo -n "prepend filename with current date? (y/n) "
-read -e USE_DATE
-
-if $USE_DATE
-       then
-       FILE=$DATE_$2   
-else
-       FILE=$2
-fi
-
-if test -d content/$FOLDER
-       then
-       echo "dir already exists..."
-else
-       mkdir content/$FOLDER
-fi
-
-echo -e "title = $2\ndate = $DATE\ndraft = true\n--\n\n" > content/$FOLDER/$FILE
-emacs content/$FOLDER/$FILE
\ No newline at end of file
diff --git a/scripts/content.sh b/scripts/content.sh
new file mode 100755 (executable)
index 0000000..7eca2ef
--- /dev/null
@@ -0,0 +1,35 @@
+DATE=$(date +%Y"-"%m"-"%d) # 2011-10-04
+VDATE=$(date +%a", "%b" "%d" "%Y", "%r"; "%Z) # Tue, Oct 4 2011, 12:46:34; IST 
+CONTENT='content'
+FOLDER=$1
+TITLE=$2
+FILE=''
+
+# create filename
+read -p "prepend filename with current date? (y/n) "
+if [ "$REPLY" == "y" ]; then
+       FILE=${DATE}_$2
+else
+       FILE=$2
+fi
+
+# does file exist?
+if [ -e "$CONTENT/$FOLDER/$FILE" ]; then
+       echo "file exists"
+       exit
+fi
+
+# create folder if doesn't exist
+if [ ! -d "$CONTENT/$FOLDER" ]; then
+       mkdir "$CONTENT/$FOLDER"        
+fi
+
+# populate initial variables
+cat > "$CONTENT/$FOLDER/$FILE" << XXX
+title = $TITLE
+date = $VDATE
+draft = true
+--
+XXX
+
+echo "$CONTENT/$FOLDER/$FILE"