bad commit

This commit is contained in:
2020-05-13 14:46:06 +02:00
parent da37523245
commit ceee7e85f9
3 changed files with 40 additions and 1 deletions

29
test/check_assets.sh Normal file
View 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
View File

@@ -0,0 +1,2 @@
POSTS_DIR="../content/posts"
ASSETS_DIR="../assets"

19
test/rename_posts.sh Executable file
View 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