bad commit
This commit is contained in:
29
test/check_assets.sh
Normal file
29
test/check_assets.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -f config.sh ]; then
|
||||
. config.sh
|
||||
fi
|
||||
|
||||
if [ -z "$POSTS_DIR" ]
|
||||
then
|
||||
echo "POSTS_DIR environment variable is unset." > /dev/stderr
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ -z "$ASSETS_DIR" ]
|
||||
then
|
||||
echo "ASSETS_DIR environment variable is unset." > /dev/stderr
|
||||
exit 2
|
||||
fi
|
||||
|
||||
rc=0
|
||||
sed -rn 's|^.*\!\[.*\]\(%assets_url%/(.*)\)$|\1|p' $POSTS_DIR/* | while read line
|
||||
do
|
||||
if [ ! -f "$ASSETS_DIR/$line" ]
|
||||
then
|
||||
echo "$line not found"
|
||||
rc=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $rc
|
||||
2
test/config.sh
Normal file
2
test/config.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
POSTS_DIR="../content/posts"
|
||||
ASSETS_DIR="../assets"
|
||||
19
test/rename_posts.sh
Executable file
19
test/rename_posts.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -f config.sh ]; then
|
||||
. config.sh
|
||||
fi
|
||||
|
||||
if [ -z "$POSTS_DIR" ]
|
||||
then
|
||||
echo "POSTS_DIR environment variable is unset." > /dev/stderr
|
||||
exit 2
|
||||
fi
|
||||
|
||||
cd $POSTS_DIR
|
||||
for post in *
|
||||
do
|
||||
title=`sed -n 's/^title: "\?\(.*\)"\?$/\1/p' $post`
|
||||
safename=`echo $title | iconv -t ascii//TRANSLIT | tr '[:upper:]' '[:lower:]' | tr -s '[:punct:] ' '-' | sed 's/-*$//g;s/^-*//g'`
|
||||
mv -v $post $safename.md 2> /dev/null
|
||||
done
|
||||
Reference in New Issue
Block a user