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 - A) There are many ways, the simplest is just use Ceramic -
http://ceramic.github.io/ which uses electron. You can of course use any 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. 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: Q) I want to take an HTML snapshot of a clog created page:
(format t "=> ~A" (outer-html (document-element (html-document body)))) (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. 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> <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 <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> </ul>
<p>CLOG-Obj - General Properties</p> <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> clog-user:<em>body</em> to last window openned to /repl.</p></li>
</ul> </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>Functions for Compilation and Documentation</p>
<p><a id='x-28CLOG-3ALOAD-WORLD-20FUNCTION-29'></a></p> <p><a id='x-28CLOG-3ALOAD-WORLD-20FUNCTION-29'></a></p>

View file

@ -92,7 +92,24 @@ clog-user:*body* to last window openned to /repl."
:path "/repl") :path "/repl")
(open-browser :url "http://127.0.0.1:8080/repl") (open-browser :url "http://127.0.0.1:8080/repl")
(format t "Use clog-user:*body* to access the clog-repl window.")) (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 ;; ;; load-world ;;
;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;

View file

@ -784,13 +784,14 @@ embedded in a native template application.)"
(defsection @clog-helpers (:title "CLOG Helper Functions") (defsection @clog-helpers (:title "CLOG Helper Functions")
"Tutorial and demo helpers" "Tutorial and demo helpers"
(clog-install-dir function) (clog-install-dir function)
(open-manual function) (open-manual function)
(run-tutorial function) (run-tutorial function)
(load-tutorial function) (load-tutorial function)
(run-demo function) (run-demo function)
(load-demo function) (load-demo function)
(clog-repl function) (clog-repl function)
(save-body-to-file function)
"Functions for Compilation and Documentation" "Functions for Compilation and Documentation"
(load-world function) (load-world function)