Testing code

So, RSS is now working, which means I can focus on the important part: code.

# Step 5: RSS
DATE=$(date -R)
cat ${TEMPLATE_DIR}/rss_header.xml | sed "s/^\(.*\)::DATE::\(.*\)$/\1${DATE}\2/" > ${RSSFILE}
# Let's add the articles
sort -nr $SORTEDFILE | head -n 10 | while read post
    FILE=$( echo $post | sed 's/^.*::\(.*\)$/\1/')
    TITLE=$(get_title ${FILE})
    URL=${BASE_URL}/$(echo ${FILE} |
        sed 's/^.*\/\(.*\)$/\1/' |
        sed 's/\.txt$/.html/')
    URL="$( echo ${URL} | normalize)"
    DATE=$( echo $post | sed 's/^\([^:]*\)::.*$/\1/' | normalize )
    TEXT="$(get_text ${FILE})"
    TEXT=$(echo ${TEXT} | normalize)
    cat ${TEMPLATE_DIR}/rss_item.xml |
        sed "s/::TITLE::/${TITLE}/" |
        sed "s/::LINK::/${URL}/" |
        sed "s/::DATE::/$(date -Rd ${DATE})/" |
        sed "s/::DESC::/${TEXT}/" >> ${RSSFILE}

cat ${TEMPLATE_DIR}/rss_footer.xml >> ${RSSFILE}

First time I tried that, it was rather dissapointing. It seems to be working better now.