Added ability to choose post type with newpost() function.
authorMark Szymanski <mrman208@me.com>
Tue, 16 Nov 2010 02:29:36 +0000 (20:29 -0600)
committerMark Szymanski <mrman208@me.com>
Tue, 16 Nov 2010 02:29:36 +0000 (20:29 -0600)
plugins/jekyll.plugins.bash

index 9a044a9..adb39fc 100644 (file)
@@ -10,6 +10,44 @@ newpost() {
 
        FNAME_DATE=$(date "+%Y-%m-%d")
 
+       # If the user is using markdown formatting, let them choose what type of post they want. Sort of like Tumblr. 
+       # TODO: Add support for Textile formatting too.
+
+       OPTIONS="Text Quote Image Audio Video"
+
+       select OPTION in $OPTIONS
+       do
+               if [[ $OPTION = "Text" ]] 
+               then
+                       POST_TYPE="Text"
+                       break
+               fi
+
+               if [[ $OPTION = "Quote" ]]
+               then
+                       POST_TYPE="Quote"
+                       break
+               fi
+       
+               if [[ $OPTION = "Image" ]]
+               then
+                       POST_TYPE="Image"
+                       break
+               fi
+
+               if [[ $OPTION = "Audio" ]]
+               then
+                       POST_TYPE="Audio"
+                       break
+               fi
+
+               if [[ $OPTION = "Video" ]]
+               then
+                       POST_TYPE="Video"
+                       break
+               fi
+       done
+
        # Get the title for the new post
 
        read -p "Enter title of the new post: " POST_TITLE
@@ -52,6 +90,35 @@ newpost() {
        echo "---" >> $FNAME
        echo >> $FNAME
 
+       # Generate template text based on the post type
+
+       if [[ $POST_TYPE = "Text" ]]
+       then
+               true
+       fi
+
+       if [[ $POST_TYPE = "Quote" ]]
+       then
+               echo "> Quote" >> $FNAME
+               echo >> $FNAME
+               echo "&mdash; Author" >> $FNAME
+       fi
+
+       if [[ $POST_TYPE = "Image" ]]
+       then
+               echo "![Alternate Text](/path/to/image/or/url)" >> $FNAME
+       fi
+
+       if [[ $POST_TYPE = "Audio" ]]
+       then
+               echo "<audio src=\"/path/to/audio/file\" controls=\"controls\"></audio>" >> $FNAME
+       fi
+
+       if [[ $POST_TYPE = "Video" ]]
+       then
+               echo "<video src=\"/path/to/video\" controls=\"controls\"></video>" >> $FNAME
+       fi
+
        # Open the file in your favorite editor
 
        $EDITOR $FNAME