#!/bin/bash
. $(ffoom path) || exit 3
ffoo import pretty
CSDEMO_FNAME=$1
CSDEMO_BG="$(mktemp)"
CSDEMO_FG="$(mktemp)"
xd2html() {
local name color
while read line;
do
name="${line%%:*}"
color="${line##*:}"
test -n "$name" || continue
test -n "$color" || continue
debug -v name color
test "$name" == "URxvt.background" && echo "$color" > $CSDEMO_BG
test "$name" == "URxvt.foreground" && echo "$color" > $CSDEMO_FG
echos "
$name
"
done
}
htmlhead() {
echos ""
echos ""
echos " "
echos " $CSDEMO_FNAME"
echos " "
echos " "
echos " "
}
htmltail() {
echos " "
echos ""
}
css() {
echos "body {"
echos " font-size: xx-large;"
echos " font-family: monospace;"
echos " color: $(cat $CSDEMO_FG);"
echos " background-color: $(cat $CSDEMO_BG);"
echos "}"
}
test -n "$CSDEMO_FNAME" || usage_is "scheme.Xresources"
htmlhead > $CSDEMO_FNAME.html
cat $CSDEMO_FNAME | xd2html >> $CSDEMO_FNAME.html
htmltail >> $CSDEMO_FNAME.html
debug -f $CSDEMO_FG $CSDEMO_BG
test -s "$CSDEMO_FG" || die "failed to parse URxvt.foreground"
test -s "$CSDEMO_BG" || die "failed to parse URxvt.background"
css > $CSDEMO_FNAME.css
rm $CSDEMO_BG
rm $CSDEMO_FG