monochromatic

monochromatic blog: http://blog.z3bra.org
git clone git://z3bra.org/monochromatic
Log | Files | Refs

commit ce0603dcd3f6877234efc1c4cf40e22deaa38eff
parent 48031c46089a17363b148ee7738cd76bf5870053
Author: z3bra <willy@mailoo.org>
Date:   Mon, 27 Oct 2014 09:47:19 +0100

Fixed errors related to the RSS file

Diffstat:
check.sh | 77++++++++++++++++++++++++++++++++++++++++++++++-------------------------------
feeds.sh | 4+++-
index.txt | 1-
3 files changed, 49 insertions(+), 33 deletions(-)

diff --git a/check.sh b/check.sh @@ -14,7 +14,7 @@ function w3c_valid () { } function rss_valid () { - if (curl -s "$check" | grep -o 'Sorry' >/dev/null); then + if (curl -s "$1" | grep -o 'Sorry' >/dev/null); then echo -e "[\033[1;31mFAIL\033[0m]" echo -e " Errors : $1" exit 1 @@ -23,38 +23,53 @@ function rss_valid () { # HTML files - -http=http://validator.w3.org/check -count=0 -total=`find -name '*.html'|wc -l` -for file in `find -name '*.html'`; do - - count=$(( $count+1 )) - echo -ne "\rChecking HTML file(s) ... $count/$total" - - full_uri=${uri}/${file/.\//} - check="${http}?uri=${full_uri}&charset=${charset}&$doctype=${doctype}" - - w3c_valid "$check" - echo -ne "\rChecking HTML file(s) ... " -done - -echo -e "[\033[1;32m OK \033[0m]" +check_html() { + http=http://validator.w3.org/check + count=0 + total=`find -name '*.html'|wc -l` + for file in `find -name '*.html'`; do + + count=$(( $count+1 )) + echo -ne "\rChecking HTML file(s) ... $count/$total" + + full_uri=${uri}/${file/.\//} + check="${http}?uri=${full_uri}&charset=${charset}&$doctype=${doctype}" + + w3c_valid "$check" + echo -ne "\rChecking HTML file(s) ... " + done + + echo -e "[\033[1;32m OK \033[0m]" +} # CSS files -echo -n 'Checking CSS file(s) ... ' - -http=http://jigsaw.w3.org/css-validator/validator -check="${http}?uri=${uri}&profile=${profile}" - -w3c_valid "$check" -echo -e "[\033[1;32m OK \033[0m]" - +check_css() { + echo -n 'Checking CSS file(s) ... ' + + http=http://jigsaw.w3.org/css-validator/validator + check="${http}?uri=${uri}&profile=${profile}" + + w3c_valid "$check" + echo -e "[\033[1;32m OK \033[0m]" +} # RSS feed -echo -n 'Checking RSS file(s) ... ' -http=http://feedvalidator.org/check.cgi -check="${http}?url=${uri}/rss/feed.xml" +check_rss() { + echo -n 'Checking RSS file(s) ... ' + http=http://feedvalidator.org/check.cgi + check="${http}?url=${uri}/rss/feed.xml" + + rss_valid "$check" + echo -e "[\033[1;32m OK \033[0m]" +} + +case $1 in + rss) check_rss ;; + css) check_css ;; + html) check_html ;; + *) check_html + check_css + check_rss ;; +esac -rss_valid "$check" -echo -e "[\033[1;32m OK \033[0m]" +exit 0 diff --git a/feeds.sh b/feeds.sh @@ -11,7 +11,9 @@ cat << EOF <link>http://blog.z3bra.org</link> EOF -sed -e "s/^## .*$/<description>/" \ +sed -e "/^<!--/d" \ + -e "s/<[\/]\?[^<>]*>/\"/g" \ + -e "s/^## .*$/<description>/" \ -e "s/^$/<\/description>\\n<\/item>/" \ -e "s/^# \[\(.*\)\](\(.*\))/<item>\n<title>\1<\/title>\n<guid>\2<\/guid>/" \ -e "s/<guid>/&http:\/\/blog.z3bra.org/" $1 diff --git a/index.txt b/index.txt @@ -5,7 +5,6 @@ safe ? # [shred config.h](/2014/08/shred-configh.html) ## &mdash; 27 August, 2014 - Have your ever wanted to kill yourself (or the dev) because you are tired of dealing with those `config.h` files ? Let me introduce you a quick organisation that will save you some headache.