browse-kawa-manual 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. #|
  3. # This is a hybrid shell/Scheme script for browsing Kawa's documentation.
  4. # It reads (and uncompresses) the documentation in ../doc/kawa-manual.epub.
  5. #
  6. # It has ONE MAJOR BUG: Clicking an external link replaces the entire
  7. # window without any way of getting back. (It should instead create
  8. # a new window/tab in your default desktop browser. Fixing this would
  9. # require more coding than it is worth.)
  10. #
  11. thisfile=`type -p $0`
  12. case "$thisfile" in
  13. "") echo "installation error - can't find path to $0"; exit -1 ;;
  14. /*) ;;
  15. *) thisfile="$PWD/$thisfile" ;;
  16. esac
  17. while test -L "$thisfile"; do thisfile=$(readlink -f "$thisfile"); done
  18. KAWA_HOME=`echo $(dirname $thisfile) | sed -e 's|/doc$||'`
  19. if test -n "$JAVA_HOME"; then
  20. JAVA="${JAVA_HOME}/bin/java"
  21. else
  22. JAVA=${JAVA-java}
  23. fi
  24. exec ${JAVA-"java"} -jar ${KAWA_HOME}/lib/kawa.jar $thisfile
  25. |#
  26. (require 'javafx-defs)
  27. (javafx-application)
  28. (javafx-scene
  29. title: "Kawa documentation"
  30. width: 800 height: 700 ;;fill: Color: "#666970"
  31. (let* ((browser (javafx.scene.web.WebView))
  32. (web-engine (browser:getEngine))
  33. (manual-url (resource-url "../doc/kawa-manual.epub")))
  34. ;; Using an <iframe> for the sidebar on WebView doesn't work for some
  35. ;; unknown reason so we use the <frameset> version instead.
  36. ;; (web-engine:load &{jar:&[manual-url]!/OEBPS/index.xhtml})
  37. (web-engine:load &{jar:&[manual-url]!/OEBPS/with-frames.html})
  38. browser))