diff options
Diffstat (limited to 'blogger.sh')
-rwxr-xr-x | blogger.sh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/blogger.sh b/blogger.sh new file mode 100755 index 0000000..4a50e3f --- /dev/null +++ b/blogger.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +blogfile="./blogs" +outfile="./blogs/output" +index="./blogs/output/index.html" + + +mkdir -p $outfile +rm -rf outfile/*.html + +echo """ +<h1 id=blogtitle>Thing1's blogs!</h1> +<link rel=\"stylesheet\" href=\"style.css\"> +<br> +<br> +<br> +<br> +""" > $index + +blogs=$(ls $blogfile/*.blog) +for i in $blogs; do + out=$(echo $i | rev | cut -d '/' -f 1 | cut -d '.' -f 2- | rev) + + echo """ +<title>${out}</title> +<body> +<h1 id=blogtitle>$out</h1> + """ > $outfile/$out.html + + cat $i | ./blogtohtml >> $outfile/$out.html + + echo """ +</body> + """ >> $outfile/$out.html + + echo "<a id=bloglink href=${out}.html>${out}</a>" >> $index +done |