My dotfiles. Period.

mkdemo 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. . <(ffoom init)
  3. ffoo import core
  4. CSDEMO_FNAME=$1
  5. CSDEMO_BG="$(mktemp)"
  6. CSDEMO_FG="$(mktemp)"
  7. xd2html() {
  8. local name color
  9. while read line;
  10. do
  11. name="${line%%:*}"
  12. color="${line##*:}"
  13. test -n "$name" || continue
  14. test -n "$color" || continue
  15. debug -v name color
  16. test "$name" == "URxvt.background" && echo "$color" > $CSDEMO_BG
  17. test "$name" == "URxvt.foreground" && echo "$color" > $CSDEMO_FG
  18. echos " <p style='color: $color'>$name</p>"
  19. done
  20. }
  21. htmlhead() {
  22. echos "<!doctype html>"
  23. echos "<html>"
  24. echos " <head>"
  25. echos " <title>$CSDEMO_FNAME</title>"
  26. echos " <link rel='stylesheet' href='$CSDEMO_FNAME.css'>"
  27. echos " </head>"
  28. echos " <body>"
  29. }
  30. htmltail() {
  31. echos " </body>"
  32. echos "</html>"
  33. }
  34. css() {
  35. echos "body {"
  36. echos " font-size: xx-large;"
  37. echos " font-family: monospace;"
  38. echos " color: $(cat $CSDEMO_FG);"
  39. echos " background-color: $(cat $CSDEMO_BG);"
  40. echos "}"
  41. }
  42. test -n "$CSDEMO_FNAME" || usage_is "scheme.Xresources"
  43. htmlhead > $CSDEMO_FNAME.html
  44. cat $CSDEMO_FNAME | xd2html >> $CSDEMO_FNAME.html
  45. htmltail >> $CSDEMO_FNAME.html
  46. debug -f $CSDEMO_FG $CSDEMO_BG
  47. test -s "$CSDEMO_FG" || die "failed to parse URxvt.foreground"
  48. test -s "$CSDEMO_BG" || die "failed to parse URxvt.background"
  49. css > $CSDEMO_FNAME.css
  50. rm $CSDEMO_BG
  51. rm $CSDEMO_FG