Use previous blog post index when deleting
This commit is contained in:
parent
74437ea53a
commit
f15a234346
|
@ -105,7 +105,8 @@ function delete_blog {
|
|||
return
|
||||
fi
|
||||
CURRENT_INDEX=$(cat $CURRENT_BLOG_INDEX)
|
||||
LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${CURRENT_INDEX}_post.rst
|
||||
PREVIOUS_INDEX=$((CURRENT_INDEX - 1))
|
||||
LAST_BLOG_ENTRY=$BLOG_CONTENT_PATH/${PREVIOUS_INDEX}_post.rst
|
||||
if [ ! -f $LAST_BLOG_ENTRY ]; then
|
||||
return
|
||||
fi
|
||||
|
@ -118,8 +119,10 @@ function delete_blog {
|
|||
case $sel in
|
||||
0) rm $LAST_BLOG_ENTRY
|
||||
if [ $CURRENT_INDEX -gt 0 ]; then
|
||||
CURRENT_INDEX=$((CURRENT_INDEX - 1))
|
||||
CURRENT_INDEX=$PREVIOUS_INDEX
|
||||
echo "$CURRENT_INDEX" > $CURRENT_BLOG_INDEX
|
||||
else
|
||||
rm -f $CURRENT_BLOG_INDEX
|
||||
fi
|
||||
regenerate_blog
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue