Skip to content

Commit

Permalink
More repl dev support
Browse files Browse the repository at this point in the history
  • Loading branch information
rabbibotton committed Nov 7, 2021
1 parent 1466d8c commit fdd9496
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
6 changes: 4 additions & 2 deletions FAQ
Original file line number Diff line number Diff line change
Expand Up @@ -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)
10 changes: 9 additions & 1 deletion doc/clog-manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ <h2><a href="#x-28CLOG-3A-40CLOG-OBJ-20MGL-PAX-3ASECTION-29">6 CLOG Objects</a><
<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>
Expand Down Expand Up @@ -6330,6 +6330,14 @@ <h2><a href="#x-28CLOG-3A-40CLOG-HELPERS-20MGL-PAX-3ASECTION-29">20 CLOG Helper
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>
Expand Down
19 changes: 18 additions & 1 deletion source/clog-helpers.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,24 @@ clog-user:*body* to last window openned to /repl."
:path "/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 ;;
;;;;;;;;;;;;;;;;
Expand Down
15 changes: 8 additions & 7 deletions source/clog.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -784,13 +784,14 @@ embedded in a native template application.)"

(defsection @clog-helpers (:title "CLOG Helper Functions")
"Tutorial and demo helpers"
(clog-install-dir function)
(open-manual function)
(run-tutorial function)
(load-tutorial function)
(run-demo function)
(load-demo function)
(clog-repl function)
(clog-install-dir function)
(open-manual function)
(run-tutorial function)
(load-tutorial function)
(run-demo function)
(load-demo function)
(clog-repl function)
(save-body-to-file function)

"Functions for Compilation and Documentation"
(load-world function)
Expand Down

0 comments on commit fdd9496

Please sign in to comment.