monochromatic

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

commit 717c2ad644aa559c20f96d79686f234b397492bb
parent 2fd8498bca7a3179ac8f214eb0ee780cd640f759
Author: Willy Goiffon <willy@mailoo.org>
Date:   Wed, 30 Oct 2013 16:01:48 +0100

Added an RSS feed to the blog

Diffstat:
rss/feed.xml | 49+++++++++++++++++++++++++++++++++++++++++++++++++
tools/check.sh | 12+++++++++++-
tools/feeds.sh | 33+++++++++++++++++++++++++++++++++
3 files changed, 93 insertions(+), 1 deletion(-)

diff --git a/rss/feed.xml b/rss/feed.xml @@ -0,0 +1,49 @@ +<?xml version='1.0'?> +<rss version='2.0'> +<channel> +<title>Monochromatic</title> +<description>z3bra, the stripes appart</description> +<link>http://blog.z3bra.org</link> +<item> +<title> +Home, sweet home +</title> +<description> +There is no place like home. And this is why setting up your +If you want advices on how to build a cosy and nice graphical +environment, take a look here. +</description> +</item> +<item> +<title> +Java without Eclipse +</title> +<description> +Are you disapointed to leave your perfect UNIX environnment +(vim, bash, git, ...) when it comes to java ..? +Have you ever tried managing a Java project by hand ..? +Trust me, it is possible ! +</description> +</item> +<item> +<title> +The Hard way +</title> +<description> +Do you encounter difficulties to master a tool ? Or maybe you find that you don't +have enough free time to put yourself into learning how to do this or that ? +Here is a well-known technic, to learn stuffs quickly, and efficiently. +</description> +</item> +<item> +<title> +Test your CSS ! +</title> +<description> +Here a simple page with a few HTML tags. +It's pretty useful to test your CSS, even if there are no 'difficult' layouts. +Feel free to download and share! +</description> +</item> +</channel> +</rss> diff --git a/tools/check.sh b/tools/check.sh @@ -1,12 +1,12 @@ #!/bin/bash -http=http://validator.w3.org/check uri=blog.z3bra.org charset=utf-8 doctype=Inline profile=css3 +http=http://validator.w3.org/check check="${http}?uri=${uri}&charset=${charset}&$doctype=${doctype}" if [[ -n "$(curl -s "$check" | grep -o 'Passed')" ]]; then @@ -23,3 +23,13 @@ if [[ -n "$(curl -s "$check" | grep -o 'No Error')" ]]; then else echo -e "\033[1;31mCSS not valid!\033[0m\ncheck $check" fi + + +http=http://feedvalidator.org/check.cgi +check="${http}?url=${uri}/rss/feed.xml" + +if [[ -n "$(curl -s "$check" | grep -o 'valid RSS feed')" ]]; then + echo -e "\033[1;32mRSS validated!\033[0m" +else + echo -e "\033[1;31mRSS not valid!\033[0m\ncheck $check" +fi diff --git a/tools/feeds.sh b/tools/feeds.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +RSS=rss/feed.xml + +cat << EOF > $RSS +<?xml version='1.0'?> +<rss version='2.0'> +<channel> +<title>Monochromatic</title> +<description>z3bra, the stripes appart</description> +<link>http://blog.z3bra.org</link> +<item> +EOF + +sed -n '/section/,/section/p' index.html >> $RSS + +# dat regex... Delete lines with <section>, </section>, <p>, </p>, <br />, <h2> +# to </h2> or <!-- +sed -i '/<\/*section>/d;/<\/\?[pb]\+[/r ]*>/d;/<h2>/,/<\/h2>/d;/<!--/d' $RSS + +# change <article> in <description>, <h1> in <title>, ^$ in <item> +sed -i 's/^\s*//' $RSS +sed -i '/^$/{N;s/\n//}' $RSS +sed -i 's/<\(\/\)\?article>/<\1description>/' $RSS +sed -i 's/<\(\/\)\?h1>/<\1title>/' $RSS +sed -i 's/^$/<\/item>\n<item>/' $RSS +sed -i 's/<a\ .*>\(.*\)<\/a>/\1/' $RSS + +cat << EOF >> $RSS +</item> +</channel> +</rss> +EOF