Add some logging to _make_tags.sh
This commit is contained in:
parent
f39609c139
commit
eeaf2997f8
@ -10,10 +10,11 @@ layout="posts-by-tag"
|
|||||||
for tag in `grep -h ^tags: _posts/* | sed -re 's/^tags: +\[//' -e 's/\]$//' -e 's/, /\n/g' | sort | uniq`
|
for tag in `grep -h ^tags: _posts/* | sed -re 's/^tags: +\[//' -e 's/\]$//' -e 's/, /\n/g' | sort | uniq`
|
||||||
do
|
do
|
||||||
tag_file="blog/tag/${tag}.html"
|
tag_file="blog/tag/${tag}.html"
|
||||||
|
echo -n "[$tag] "
|
||||||
|
|
||||||
if [ ! -f $tag_file ]
|
if [ ! -f $tag_file ]
|
||||||
then
|
then
|
||||||
echo "Creating $tag_file"
|
echo "creating ($tag_file)"
|
||||||
|
|
||||||
cat <<EOF > $tag_file
|
cat <<EOF > $tag_file
|
||||||
---
|
---
|
||||||
@ -22,14 +23,21 @@ tag: $tag
|
|||||||
---
|
---
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
if ! egrep "^tag: +${tag}$" $tag_file 2>&1 > /dev/null
|
updated=0
|
||||||
then
|
if ! egrep "^tag: +${tag}$" $tag_file 2>&1 > /dev/null; then
|
||||||
|
echo "adding tag"
|
||||||
sed -i "0,/---/! s/---/tag: $tag\\n---/" $tag_file
|
sed -i "0,/---/! s/---/tag: $tag\\n---/" $tag_file
|
||||||
|
updated=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! egrep "^layout: +" $tag_file 2>&1 > /dev/null
|
if ! egrep "^layout: +" $tag_file 2>&1 > /dev/null; then
|
||||||
then
|
echo "adding layout"
|
||||||
sed -i "0,/---/! s/---/layout: $layout\\n---/" $tag_file
|
sed -i "0,/---/! s/---/layout: $layout\\n---/" $tag_file
|
||||||
|
updated=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $updated == 0 ]; then
|
||||||
|
echo ""
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user