1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #!/bin/bash
-
- . <(ffoom init)
-
- ffoo import core
-
- 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 " <p style='color: $color'>$name</p>"
- done
- }
-
- htmlhead() {
- echos "<!doctype html>"
- echos "<html>"
- echos " <head>"
- echos " <title>$CSDEMO_FNAME</title>"
- echos " <link rel='stylesheet' href='$CSDEMO_FNAME.css'>"
- echos " </head>"
- echos " <body>"
- }
-
- htmltail() {
- echos " </body>"
- echos "</html>"
- }
-
- 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
|