summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh28
1 files changed, 23 insertions, 5 deletions
diff --git a/build.sh b/build.sh
index ab0559e..ff6f951 100755
--- a/build.sh
+++ b/build.sh
@@ -55,8 +55,13 @@ function generate_index() {
# strip out the footer
sed -i '1,/<\/footer>/{/<footer>/,$d}' $page_file
+
+ #tidy
+ tidy_file $page_file
+
echo "Copying $page_file to $base_dir/index.html"
cp $page_file $base_dir/index.html
+
echo "Searching for more directories to index"
for dir in $base_dir/*; do
if [ ! -d $dir ]; then
@@ -184,6 +189,11 @@ function add_to_rss() {
}" templates/rss-item.xml >> ${rss_data}
}
+function tidy_file() {
+ local file=$1
+ tidy -mq -config tidy.conf $file
+}
+
echo "Clearing build-cache"
rm -rf $BUILD
mkdir $BUILD
@@ -216,7 +226,7 @@ for post in posts/*.*; do
tags=$(extract_metadata "tags" $post)
type=$(extract_metadata "type" $post)
pinned=$(extract_metadata "pinned" $post)
-
+ notidy=$(extract_metadata "notidy" $post)
post_file=$(mktemp_file "post")
content_file=$(mktemp_file "content")
@@ -245,6 +255,14 @@ for post in posts/*.*; do
echo "Setting tags"
set_tags "$tags" $post_file
+ # tidy
+ if [-z "$notidy" ]; then
+ echo "Tidying post"
+ tidy_file $post_file
+ else
+ echo "Skipping tidy for $post_file"
+ fi
+
echo "Copying temp_file to www/"
filename=$(basename $post)
url=""
@@ -293,6 +311,8 @@ function set_pinned() {
fi
}
+
+
echo "Generate homepage"
homepage=$(mktemp_file "homepage")
generate_page "home" posts/index.html $homepage
@@ -305,8 +325,10 @@ cp $homepage www/index.html
echo "Copying static-html"
cp -r static-html/* www/
+
echo "Copying res to www"
cp -r res/ www/media/
+
echo "Building http rss"
feed=$(mktemp_file "rss_feed")
year="$(date +%Y)"
@@ -318,16 +340,12 @@ sed -E -e "{
r ${rss_data}
d}
}" templates/feed.rss > $feed
-
cp $feed www/blog/feed.rss
echo "Generating index files"
generate_index "www/blog"
generate_index "www/music"
-echo "Tidying HTML files"
-./tidy.sh
-
echo "Granting permissions"
chmod -R 755 www