Update postToBlog.sh

This commit is contained in:
张壹 2018-11-12 16:24:34 -08:00
parent e89dd055b2
commit 8e8f8bc790

View File

@ -27,10 +27,10 @@ do
dispUsage "${0##*/} -i<markdown-file> [-l<layout>] [-T<title>] [-c<categories>] [-t<tags>] [-s<sub-directory>] [-S] [-h]"
dispOptionShort "-i" "Input markdown file. The default is '${_mfile}'."
dispOptionShort "-l" "Page layout defined in Jekyll's styles. The default is '${_layout}'."
dispOptionShort "-T" "Blog title. The default will use the h1 level title in the input markdown file. The use of this option will overwrite the default. The output filename will use the current date plus the blog title. Note that following symbols in the title will be replaced by the '-' symbol: '!','@','#','$','%','^','&','*','_',':'."
dispOptionShort "-T" "Blog title. The default will use the h1 level title in the input markdown file. The use of this option will overwrite the default. The output filename will use the current date plus the blog title. Note that following symbols in the title will be replaced by the '-' symbol: '.',!','@','#','$','%','^','&','*','_',':'."
dispOptionShort "-c" "Blog categories that are separated by commas. The default is/are '${_categories}'."
dispOptionShort "-t" "Blog tags that are separated by commas. The default is/are '${_tags}'."
dispOptionShort "-s" "Sub-directory of the posts. The main directory of the posts is placed under '${_posts_address}' folder of your Github.io directory. The default is ${_posts_sub_address}."
dispOptionShort "-s" "Sub-directory of the posts. The main directory of the posts is placed under '${_posts_address}' folder of your Github.io directory. The default is '${_posts_sub_address}'."
dispOptionShort "-S" "Save output markdown file. The default will remove the output file after committing the blog to Github."
dispOptionShort "-h" "Show help information."
exit 0;;
@ -69,7 +69,7 @@ if [[ ${_title} != 'Null' ]]; then
exit 1
fi
# remove special symbols from the title
_outfile_end=${_title//[:_!@#\$\%\^\&\*]/''}
_outfile_end=${_title//[.:_!@#\$\%\^\&\*]/''}
_outfile_end=${_outfile_end// /-}
else
#读入输入文件输出到临时文件
@ -92,7 +92,7 @@ else
if [[ ${_outfile_end} != 'Null' ]]; then
_title=${_outfile_end}
# remove special symbols from the h1 title
_outfile_end=${_outfile_end//[:_!@#\$\%\^\&\*]/''}
_outfile_end=${_outfile_end//[.:_!@#\$\%\^\&\*]/''}
_outfile_end=${_outfile_end// /-}
else
printf "\e[1m\e[31mError ==>\e[0m No h1 level title found in: ${_mfile}.\n"
@ -101,7 +101,7 @@ else
read _outfile_end
_title=${_outfile_end}
# remove special symbols from the input title
_outfile_end=${_outfile_end//[:_!@#\$\%\^\&\*]/''}
_outfile_end=${_outfile_end//[.:_!@#\$\%\^\&\*]/''}
_outfile_end=${_outfile_end// /-}
fi
fi