Added check to make sure the user is using Markdown formatting with newpost()

pull/26/head
Mark Szymanski 2010-11-15 20:31:38 -06:00
parent 12d8abda06
commit 14c78bff05
1 changed files with 56 additions and 50 deletions

View File

@ -15,38 +15,41 @@ newpost() {
OPTIONS="Text Quote Image Audio Video" OPTIONS="Text Quote Image Audio Video"
select OPTION in $OPTIONS if [[ $JEKYLL_FORMATTING = "markdown" ]]
do then
if [[ $OPTION = "Text" ]] select OPTION in $OPTIONS
then do
POST_TYPE="Text" if [[ $OPTION = "Text" ]]
break then
fi POST_TYPE="Text"
break
fi
if [[ $OPTION = "Quote" ]] if [[ $OPTION = "Quote" ]]
then then
POST_TYPE="Quote" POST_TYPE="Quote"
break break
fi fi
if [[ $OPTION = "Image" ]] if [[ $OPTION = "Image" ]]
then then
POST_TYPE="Image" POST_TYPE="Image"
break break
fi fi
if [[ $OPTION = "Audio" ]] if [[ $OPTION = "Audio" ]]
then then
POST_TYPE="Audio" POST_TYPE="Audio"
break break
fi fi
if [[ $OPTION = "Video" ]] if [[ $OPTION = "Video" ]]
then then
POST_TYPE="Video" POST_TYPE="Video"
break break
fi fi
done done
fi
# Get the title for the new post # Get the title for the new post
@ -92,31 +95,34 @@ newpost() {
# Generate template text based on the post type # Generate template text based on the post type
if [[ $POST_TYPE = "Text" ]] if [[ $JEKYLL_FORMATTING = "markdown" ]]
then then
true if [[ $POST_TYPE = "Text" ]]
fi then
true
fi
if [[ $POST_TYPE = "Quote" ]] if [[ $POST_TYPE = "Quote" ]]
then then
echo "> Quote" >> $FNAME echo "> Quote" >> $FNAME
echo >> $FNAME echo >> $FNAME
echo "— Author" >> $FNAME echo "— Author" >> $FNAME
fi fi
if [[ $POST_TYPE = "Image" ]] if [[ $POST_TYPE = "Image" ]]
then then
echo "![Alternate Text](/path/to/image/or/url)" >> $FNAME echo "![Alternate Text](/path/to/image/or/url)" >> $FNAME
fi fi
if [[ $POST_TYPE = "Audio" ]] if [[ $POST_TYPE = "Audio" ]]
then then
echo "<audio src=\"/path/to/audio/file\" controls=\"controls\"></audio>" >> $FNAME echo "<audio src=\"/path/to/audio/file\" controls=\"controls\"></audio>" >> $FNAME
fi fi
if [[ $POST_TYPE = "Video" ]] if [[ $POST_TYPE = "Video" ]]
then then
echo "<video src=\"/path/to/video\" controls=\"controls\"></video>" >> $FNAME echo "<video src=\"/path/to/video\" controls=\"controls\"></video>" >> $FNAME
fi
fi fi
# Open the file in your favorite editor # Open the file in your favorite editor