@@ -20,15 +20,15 @@ tag_count=0
2020
2121
2222_read_yaml () {
23- local _endline=$( grep -n " \-\-\-" $1 | cut -d: -f 1 | sed -n ' 2p' )
24- head -$_endline $1
23+ local _endline=" $( grep -n " \-\-\-" " $1 " | cut -d: -f 1 | sed -n ' 2p' ) "
24+ head -" $_endline " " $1 "
2525}
2626
2727
2828read_categories () {
29- local _yaml=$( _read_yaml $1 )
30- local _categories=$( echo " $_yaml " | grep " ^categories:" )
31- local _category=$( echo " $_yaml " | grep " ^category:" )
29+ local _yaml=" $( _read_yaml " $1 " ) "
30+ local _categories=" $( echo " $_yaml " | grep " ^categories:" ) "
31+ local _category=" $( echo " $_yaml " | grep " ^category:" ) "
3232
3333 if [[ ! -z " $_categories " ]]; then
3434 echo " $_categories " | sed " s/categories: *//;s/\[//;s/\].*//;s/, */,/g;s/\" //g;s/'//g"
@@ -39,7 +39,7 @@ read_categories() {
3939
4040
4141read_tags () {
42- local _yaml=$( _read_yaml $1 )
42+ local _yaml=" $( _read_yaml " $1 " ) "
4343 echo " $_yaml " | grep " ^tags:" | sed " s/tags: *//;s/\[//;s/\].*//;s/, */,/g;s/\" //g;s/'//g"
4444}
4545
@@ -65,14 +65,14 @@ init() {
6565create_category () {
6666 if [[ ! -z $1 ]]; then
6767 local _name=$1
68- local _filepath=" categories/$( echo $_name | sed ' s/ /-/g' | awk ' {print tolower($0)}' ) .html"
68+ local _filepath=" categories/$( echo " $_name " | sed ' s/ /-/g' | awk ' {print tolower($0)}' ) .html"
6969
70- if [[ ! -f $_filepath ]]; then
71- echo " ---" > $_filepath
72- echo " layout: category" >> $_filepath
73- echo " title: $_name " >> $_filepath
74- echo " category: $_name " >> $_filepath
75- echo " ---" >> $_filepath
70+ if [[ ! -f " $_filepath " ]]; then
71+ echo " ---" > " $_filepath "
72+ echo " layout: category" >> " $_filepath "
73+ echo " title: $_name " >> " $_filepath "
74+ echo " category: $_name " >> " $_filepath "
75+ echo " ---" >> " $_filepath "
7676
7777 (( category_count= category_count+ 1 ))
7878 fi
@@ -83,15 +83,15 @@ create_category() {
8383create_tag () {
8484 if [[ ! -z $1 ]]; then
8585 local _name=$1
86- local _filepath=" tags/$( echo $_name | sed " s/ /-/g;s/'//g" | awk ' {print tolower($0)}' ) .html"
86+ local _filepath=" tags/$( echo " $_name " | sed " s/ /-/g;s/'//g" | awk ' {print tolower($0)}' ) .html"
8787
88- if [[ ! -f $_filepath ]]; then
88+ if [[ ! -f " $_filepath " ]]; then
8989
90- echo " ---" > $_filepath
91- echo " layout: tag" >> $_filepath
92- echo " title: $_name " >> $_filepath
93- echo " tag: $_name " >> $_filepath
94- echo " ---" >> $_filepath
90+ echo " ---" > " $_filepath "
91+ echo " layout: tag" >> " $_filepath "
92+ echo " title: $_name " >> " $_filepath "
93+ echo " tag: $_name " >> " $_filepath "
94+ echo " ---" >> " $_filepath "
9595
9696 (( tag_count= tag_count+ 1 ))
9797 fi
@@ -116,13 +116,13 @@ create_pages() {
116116
117117 $TYPE_CATEGORY )
118118 for i in ${_string# ,} ; do
119- create_category $i
119+ create_category " $i "
120120 done
121121 ;;
122122
123123 $TYPE_TAG )
124124 for i in ${_string# ,} ; do
125- create_tag $i
125+ create_tag " $i "
126126 done
127127 ;;
128128
0 commit comments