Update post2blog.sh

This commit is contained in:
张壹 2018-11-14 17:48:22 -08:00
parent b140889c61
commit f1aeb5a41d

View File

@ -157,7 +157,7 @@ if [[ ${_title} != 'Null' ]]; then
while read _oneline
do
#first get all hyper links, including websites, images and files. save them to a single string separated by whitespace
_link_string=${_link_string}`echo "${_oneline}" | grep -Eo "!?\[[a-zA-Z0-9 .-_]*\]\([a-zA-Z0-9_:/.-]*\)"`" "
_link_string=${_link_string}`echo "${_oneline}" | grep -Eo "!?\[[a-zA-Z0-9 _:/.-]*\]\([a-zA-Z0-9_:/.-]*\)"`" "
echo "${_oneline}" >> ${_tmpfile}
done < ${_mfile}
else
@ -177,7 +177,7 @@ else
_outfile_end=${_oneline:2}
else
#first get all hyper links, including websites, images and files. save them to a single string separated by whitespace
_link_string=${_link_string}`echo "${_oneline}" | grep -Eo "!?\[[a-zA-Z0-9 .-_]*\]\([a-zA-Z0-9_:/.-]*\)"`" "
_link_string=${_link_string}`echo "${_oneline}" | grep -Eo "!?\[[a-zA-Z0-9 _:/.-]*\]\([a-zA-Z0-9_:/.-]*\)"`" "
echo "${_oneline}" >> ${_tmpfile}
fi
done < ${_mfile}
@ -209,7 +209,7 @@ _outfile=${_outfile}${_outfile_end}.md
#echo ${_link_string}
#get link names from _link_string and save a string
_link_names_string=`echo ${_link_string} | grep -Eo "\[[a-zA-Z0-9 .-_]*\]"`
_link_names_string=`echo ${_link_string} | grep -Eo "\[[a-zA-Z0-9 _:/.-]*\]"`
#change whitespace in every link name into -
_link_names_string=${_link_names_string//" "/"-"}
#delete symbols \[ and \] in link names
@ -223,7 +223,7 @@ _link_names=(${_link_names_string})
#get link addresses from _link_string and save a string
_link_addresses_string=`echo ${_link_string} | grep -Eo "\([a-zA-Z0-9_:/.-]*\)"`
echo ${_link_addresses_string}
#echo ${_link_addresses_string}
#change whitespace in every link address into -
_link_addresses_string=${_link_addresses_string//" "/"-"}
#delete symbols \( and \) in link names