Compare commits
4 Commits
217105d369
...
16aa6dae2d
Author | SHA1 | Date |
---|---|---|
Jus de Patate_ | 16aa6dae2d | |
Jus de Patate_ | 7a28c1125a | |
Jus de Patate_ | a7a556a99f | |
Jus de Patate_ | db31085fd2 |
|
@ -2,3 +2,4 @@ builds/*
|
|||
src/*
|
||||
pages/*
|
||||
parts/*
|
||||
static/*
|
||||
|
|
22
mkhtml
22
mkhtml
|
@ -15,16 +15,15 @@ if [[ -d "$(pwd)/pages" && -d "$(pwd)/parts" && -d "$(pwd)/builds" ]]; then
|
|||
# Check if mandatory folders exist, make variables if yes, create them if not.
|
||||
fi
|
||||
|
||||
if [ ! -w "$BUILDSDIR" ]; then
|
||||
echo "mkhtml (executed by $(whoami)) can't write in $BUILDSDIR"
|
||||
echo "Ask your system admin to change permissions or move this whole folder"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "$(pwd)/pages" || ! -d "$(pwd)/parts" || ! -d "$(pwd)/builds" ]]; then
|
||||
mkdir {pages,parts,builds} 2>/dev/null
|
||||
echo "pages, parts and builds folders were created by mkhtml in $(pwd)"
|
||||
echo "now populate them"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -w "$BUILDSDIR" ]; then
|
||||
echo "mkhtml (executed by $(whoami)) can't write in $BUILDSDIR"
|
||||
echo "Ask your system admin to change permissions or move this whole folder"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -50,8 +49,11 @@ fi
|
|||
echo ""
|
||||
echo "Building files..."
|
||||
|
||||
cd $PAGESDIR
|
||||
find -type d -links 2 -exec mkdir -p "$BUILDSDIR/{}" \;
|
||||
|
||||
# https://stackoverflow.com/a/54563899
|
||||
cd $PAGESDIR && find . -type f -print0 | while IFS= read -r -d $'\0' file; do
|
||||
find . -type f -print0 | while IFS= read -r -d $'\0' file; do
|
||||
filename=$(echo $file | sed 's/.\///')
|
||||
newloc="$BUILDSDIR/$filename"
|
||||
touch $newloc 2>/dev/null
|
||||
|
@ -60,7 +62,7 @@ cd $PAGESDIR && find . -type f -print0 | while IFS= read -r -d $'\0' file; do
|
|||
cat "$PARTSDIR/header.html" >> "$newloc"
|
||||
cat "$PAGESDIR/$filename" >> "$newloc"
|
||||
cat "$PARTSDIR/footer.html" >> "$newloc"
|
||||
# build file using PARTS and PAGE
|
||||
# build files using PARTS and PAGE
|
||||
done
|
||||
|
||||
if [ -n "$SRCDIR" ]; then
|
||||
|
@ -74,6 +76,8 @@ if [ -n "$STATDIR" ]; then
|
|||
cp -r $STATDIR/* $BUILDSDIR
|
||||
fi
|
||||
|
||||
cd - > /dev/null
|
||||
|
||||
echo ""
|
||||
echo "Looks like all files were built"
|
||||
echo ""
|
||||
|
|
Loading…
Reference in New Issue