diff options
-rwxr-xr-x | build.sh | 28 | ||||
-rwxr-xr-x | tidy.sh | 13 |
2 files changed, 23 insertions, 18 deletions
@@ -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 diff --git a/tidy.sh b/tidy.sh deleted file mode 100755 index 6efdb2d..0000000 --- a/tidy.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -if [ $# == 0 ]; then - find www/ -name '*.html' -type f -print -exec tidy -mq -config tidy.conf '{}' \; - if [ $? -lt 2 ]; then - exit 0 - fi -else - tidy -mq -config tidy.conf $@ - if [ $? -lt 2 ]; then - exit 0 - fi -fi |