summary refs log tree commit diff
path: root/doc/user/src
diff options
context:
space:
mode:
authorLudovic Courtès2008-01-29 18:16:56 +0100
committerLudovic Courtès2008-01-29 18:16:56 +0100
commit098652444872263b7dd370d4f5b3022f79cd11a1 (patch)
tree7d4f67228287bbbe8aa41f2d76d728913c961e05 /doc/user/src
parentbda408c218cad42b482981213de79e3382df87b6 (diff)
downloadskribilo-098652444872263b7dd370d4f5b3022f79cd11a1.tar.gz
skribilo-098652444872263b7dd370d4f5b3022f79cd11a1.tar.lz
skribilo-098652444872263b7dd370d4f5b3022f79cd11a1.zip
doc: Add section about "documents in Scheme programs".
* doc/user/Makefile.am (EXTRA_DIST): Add `src/scheme.scm'.

* doc/user/syntax.skb (Documents in Scheme Programs): New.
Diffstat (limited to 'doc/user/src')
-rw-r--r--doc/user/src/scheme.scm22
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/user/src/scheme.scm b/doc/user/src/scheme.scm
new file mode 100644
index 0000000..0bb87e5
--- /dev/null
+++ b/doc/user/src/scheme.scm
@@ -0,0 +1,22 @@
+(use-modules (skribilo engine)       ;; provides `find-engine'
+	     (skribilo evaluator)    ;; provides `evaluate-document'
+	     (skribilo package base) ;; provides `chapter', etc.
+             (srfi srfi-1))
+
+(let (;; Select an engine, i.e., an output format.
+      (e (find-engine 'html))
+
+      ;; Create a document.
+      (d (document #:title "Some Title"
+	    (chapter #:title "The Chapter"
+                (p "The paragraph...  "
+                   "Text consists of "
+                   "a list of strings.")
+                (apply itemize
+                       (map number->string
+                            (iota 10)))))))
+
+  ;; "Evaluate" the document to an HTML file.
+  (with-output-to-file "foo.html"
+    (lambda ()
+      (evaluate-document d e))))