#!/bin/bash

reqd_long="response-count-quarterly-nonnorm iam-summary sv-platform-profession happy-summary easy-summary prog--multichoice vamp-summary"

reqd_imageonly="iam-quarterly location-summary sv-platform-summary sv-platform-quarterly location-platform ua-summary ua-quarterly ua-platform sv-version-summary sv-version-quarterly sv-version-platform feature--multichoice feature-image-layer-respondents sv-plugs-multichoice prog-by-profession otherlang--multichoice"

for x in $reqd_long; do
    pic_url="http://code.soundsoftware.ac.uk/projects/sv-survey-output/repository/raw/1/charts/raw/$x.png"
    short="$x"
    case "$x" in *nonnorm) short=`echo $x|sed 's/-nonnorm//'` ;; esac
    cat textout/"$short".txt | sed -e 's,^,<tr><td>,' -e 's,|,</td><td>,g' -e 's,$,</td></tr>,' -e '1i<table><tr><td><img src="'$pic_url'"></td><td><table>' -e '$a</table></td></tr></table>'> html/"$x".html
done

for x in $reqd_imageonly; do
    pic_url="http://code.soundsoftware.ac.uk/projects/sv-survey-output/repository/raw/1/charts/raw/$x.png"
    echo '<img src="'$pic_url'">' > html/"$x".html
done

