From a64ddb451dc18902c610803c1d74639a9ec06d5c Mon Sep 17 00:00:00 2001 From: Gabriel Dunne Date: Tue, 4 Oct 2011 19:25:47 +0530 Subject: [PATCH] Fixed up content.sh script --- TODO | 9 +++++ content/journal/{arrive => 2011-08-22_arrive} | 0 ...date_for_mom => 2011-10-01_update_for_mom} | 0 content/journal/{dreams => 2011-10-04_dreams} | 2 +- .../{2011_9_27_habitat => 2011-09-27_habitat} | 0 scripts/content | 22 ------------ scripts/content.sh | 35 +++++++++++++++++++ 7 files changed, 45 insertions(+), 23 deletions(-) create mode 100644 TODO rename content/journal/{arrive => 2011-08-22_arrive} (100%) rename content/journal/{update_for_mom => 2011-10-01_update_for_mom} (100%) rename content/journal/{dreams => 2011-10-04_dreams} (79%) rename content/photo/{2011_9_27_habitat => 2011-09-27_habitat} (100%) delete mode 100755 scripts/content create mode 100755 scripts/content.sh diff --git a/TODO b/TODO new file mode 100644 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 diff --git a/content/journal/arrive b/content/journal/2011-08-22_arrive similarity index 100% rename from content/journal/arrive rename to content/journal/2011-08-22_arrive diff --git a/content/journal/update_for_mom b/content/journal/2011-10-01_update_for_mom similarity index 100% rename from content/journal/update_for_mom rename to content/journal/2011-10-01_update_for_mom diff --git a/content/journal/dreams b/content/journal/2011-10-04_dreams similarity index 79% rename from content/journal/dreams rename to content/journal/2011-10-04_dreams index 5df3c9e..62e1f08 100644 --- a/content/journal/dreams +++ b/content/journal/2011-10-04_dreams @@ -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/content/photo/2011_9_27_habitat b/content/photo/2011-09-27_habitat similarity index 100% rename from content/photo/2011_9_27_habitat rename to content/photo/2011-09-27_habitat diff --git a/scripts/content b/scripts/content deleted file mode 100755 index bbff300..0000000 --- a/scripts/content +++ /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 index 0000000..7eca2ef --- /dev/null +++ b/scripts/content.sh @@ -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" -- 2.34.1