More repl dev support

This commit is contained in:
David Botton 2021-11-07 12:08:09 -05:00
parent 1466d8cc86
commit fdd94960e1
4 changed files with 39 additions and 11 deletions

6
FAQ
View file

@ -8,13 +8,15 @@ Q) How do I turn my CLOG app in to a native Mac, Windows or Linux app?
A) There are many ways, the simplest is just use Ceramic -
http://ceramic.github.io/ which uses electron. You can of course use any
tool the gives you a browser control. See clog/nativ-glues/gtk or an example
tool the gives you a browser control. See clog/native-glues/gtk or an example
with GTK in C, but you can use the cl-cffi-gtk to accomplish the same thing.
Q) I want to take an HTML snapshot of a clog created page:
(format t "=> ~A" (outer-html (document-element (html-document body))))
or (save-body-to-file)
Q) I want to know where the :CLOG tutorials, demos and sources.
Use (asdf:system-source-directory :clog)
Use (clog-install-dir)

View file

@ -514,7 +514,7 @@ alpha 0.0 - 1.0</p></li>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[class]</span> <span class="reference-object"><a href="#x-28CLOG-3ACLOG-OBJ-20CLASS-29" >CLOG-OBJ</a></span></span></span></p>
<p><code>CLOG</code> objects (clog-obj) encapsulate the connection between
lisp and the <code>HTML</code> DOM element.</p></li>
lisp and an <code>HTML</code> DOM element.</p></li>
</ul>
<p>CLOG-Obj - General Properties</p>
@ -6330,6 +6330,14 @@ If <code>ON-FULL-SCREEN-CHANGE-HANDLER</code> is nil unbind the event.</p></li>
clog-user:<em>body</em> to last window openned to /repl.</p></li>
</ul>
<p><a id='x-28CLOG-3ASAVE-BODY-TO-FILE-20FUNCTION-29'></a></p>
<ul>
<li><p><span class=reference-bullet><span class=reference><span class="locative-type">[function]</span> <span class="reference-object"><a href="#x-28CLOG-3ASAVE-BODY-TO-FILE-20FUNCTION-29" >SAVE-BODY-TO-FILE</a></span></span> <span class="locative-args">FILE-NAME &amp;KEY (BODY <code>CLOG-USER::*BODY*</code>) (IF-EXISTS <code>:ERROR</code>) IF-DOES-NOT-EXIST EXTERNAL-FORMAT</span></span></p>
<p>Save the current html of <code>BODY</code> in the current state to <code>FILE-NAME</code></p></li>
</ul>
<p>Functions for Compilation and Documentation</p>
<p><a id='x-28CLOG-3ALOAD-WORLD-20FUNCTION-29'></a></p>

View file

@ -93,6 +93,23 @@ clog-user:*body* to last window openned to /repl."
(open-browser :url "http://127.0.0.1:8080/repl")
(format t "Use clog-user:*body* to access the clog-repl window."))
;;;;;;;;;;;;;;;;;;;;;;;
;; save-body-to-file ;;
;;;;;;;;;;;;;;;;;;;;;;;
(defun save-body-to-file (file-name &key (body clog-user::*body*)
(if-exists :error)
if-does-not-exist
external-format)
"Save the current html of BODY in the current state to FILE-NAME"
(when (alexandria:write-string-into-file
(outer-html (document-element (html-document body)))
file-name
:if-exists if-exists
:if-does-not-exist if-does-not-exist
:external-format external-format)
t))
;;;;;;;;;;;;;;;;
;; load-world ;;
;;;;;;;;;;;;;;;;

View file

@ -791,6 +791,7 @@ embedded in a native template application.)"
(run-demo function)
(load-demo function)
(clog-repl function)
(save-body-to-file function)
"Functions for Compilation and Documentation"
(load-world function)