[seed] docs: Docbookify sandbox module documentation.



commit efe10ed158b941bce7f14717637c60056cb9db68
Author: Robert Carr <racarr svn gnome org>
Date:   Wed May 20 22:51:44 2009 -0400

    docs: Docbookify sandbox module documentation.
---
 configure.ac                        |    1 -
 doc/modules/Makefile.am             |    2 +-
 doc/modules/book.xml                |    1 +
 doc/modules/sandbox/Makefile.am     |   15 ++++++--
 doc/modules/sandbox/sandbox.html.in |   66 -----------------------------------
 doc/modules/sandbox/sandbox.js      |   19 ++++++++++
 doc/modules/sandbox/sandbox.xml     |   44 +++++++++++++++++++++++
 7 files changed, 76 insertions(+), 72 deletions(-)

diff --git a/configure.ac b/configure.ac
index 77bec6b..576ac19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -355,7 +355,6 @@ doc/tutorial-standalone/tutorial.html
 
 doc/modules/canvas/canvas.html
 doc/modules/multiprocessing/multiprocessing.html
-doc/modules/sandbox/sandbox.html
 
 doc/modules/canvas/Makefile
 doc/modules/multiprocessing/Makefile
diff --git a/doc/modules/Makefile.am b/doc/modules/Makefile.am
index 8dcb61a..d733182 100644
--- a/doc/modules/Makefile.am
+++ b/doc/modules/Makefile.am
@@ -1,7 +1,7 @@
 SUBDIRS=canvas multiprocessing readline sandbox sqlite gtkbuilder
 
 if ENABLE_GTK_DOC
-html/index.html: book.xml sqlite/sqlite.xml sqlite/sqlite-funcs.xml readline/readline.xml readline/readline-funcs.xml make-functions.js gtkbuilder/gtkbuilder-funcs.xml gtkbuilder/gtkbuilder.xml
+html/index.html: book.xml sqlite/sqlite.xml sqlite/sqlite-funcs.xml readline/readline.xml readline/readline-funcs.xml make-functions.js gtkbuilder/gtkbuilder-funcs.xml gtkbuilder/gtkbuilder.xml sandbox/sandbox.xml sandbox/sandbox-funcs.xml
 	mkdir -p html;
 	gtkdoc-mkhtml "Seed" book.xml;
 	mv *.html *.css *.png *.sgml *.devhelp* html
diff --git a/doc/modules/book.xml b/doc/modules/book.xml
index 9b4c6e2..8a17389 100644
--- a/doc/modules/book.xml
+++ b/doc/modules/book.xml
@@ -13,5 +13,6 @@ doc/index.html">http://www.gnome.org/~racarr/seed/modules/</ulink>.
  <xi:include href="readline/readline.xml"/>
  <xi:include href="sqlite/sqlite.xml"/>
  <xi:include href="gtkbuilder/gtkbuilder.xml"/>
+ <xi:include href="sandbox/sandbox.xml"/>
 
 </book>
diff --git a/doc/modules/sandbox/Makefile.am b/doc/modules/sandbox/Makefile.am
index 581413f..8b5d19f 100644
--- a/doc/modules/sandbox/Makefile.am
+++ b/doc/modules/sandbox/Makefile.am
@@ -1,5 +1,12 @@
-modulesdir = $(datadir)/doc/seed/modules
-modules_DATA = \
-	sandbox.html
 EXTRA_DIST = \
-	sandbox.html.in
+	sandbox.js
+
+sandbox-funcs.xml: $(top_builddir)/src/seed sandbox.js 
+	$(top_builddir)/src/seed ../make-functions.js sandbox.js > sandbox-funcs.xml
+CLEANFILES=sandbox-funcs.xml
+
+sandboxdocsdir = \
+	$(datadir)/doc/seed/modules/sandbox/html
+sandboxdocs_DATA = sandbox-funcs.xml
+
+
diff --git a/doc/modules/sandbox/sandbox.html.in b/doc/modules/sandbox/sandbox.html.in
deleted file mode 100644
index bd143e5..0000000
--- a/doc/modules/sandbox/sandbox.html.in
+++ /dev/null
@@ -1,66 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
-<html xmlns="http://www.w3.org/1999/xhtml"; lang="en" xml:lang="en">
-<head>
-	<title>Seed sandbox Module Documentation</title>
-	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
-	<link rel="stylesheet" href="../style.css" type="text/css" charset="utf-8" />
-	<script type="text/javascript" src="../sh.js"></script>
-    <script type="text/javascript" src="../sh_js.js"></script>
-    <link type="text/css" rel="stylesheet" href="../sh.css" />
-</head>
-<body onload="sh_highlightDocument();">
-<div id="header">Seed <i>sqlite</i> Module</div>
-<div id="subheader">v  VERSION@</div>
-<div class="section"><b>Usage</b></div>
-<p>
-In order to use functions from the sandbox module, you must first import it.
-</p>
-<pre class="sh_javascript">
-sandbox = imports.sandbox;
-</pre>
-<div class="section"><b>new sandbox.Context</b>()</div>
-<p>
-Creates a new sandbox context object, which wraps a Seed JavaScript context with it's own global object. By default this global object contains only default JSCore globals (Array, Object, etc..) and has no ability to interact with the outside system. Note the context must be manually destroyed with the <b>destroy</b> method (due to the finer points of garbage collection).
-</p>
-<pre class="sh_javascript">
-var context = new sandbox.Context();
-// Do things.
-context.destroy();
-</pre>
-<div class="section">context.<b>eval</b>(source)</div>
-Evaluates a string <i>source</i> with <i>context</i>, returns the result.
-<pre class="sh_javascript">
-context = new sandbox.Context();
-result = context.eval("2+2");
-</pre>
-<div class="section">context.<b>add_globals</b>()</div>
-<p>
-Adds the default Seed globals to the context, including the "Seed" global object, and the imports object.
-</p>
-<pre class="sh_javascript">
-context.add_globals();
-</pre>
-
-<div class="section">context.<b>destroy</b>()</div>
-<p>
-Destroys the internal context object, and any further usage of the wrapper is an exception.
-</p>
-<pre class="sh_javascript">
-context.destroy();
-</pre>
-<div class="section">context.<b>global</b></div>
-<p>
-A property representing the literal global object of the context. May be freely read from and assigned to.
-</p>
-<pre class="sh_javascript">
-context = new sandbox.Context();
-context.global.WindowType = Gtk.WindowType;
-
-context.eval("b = WindowType.NORMAL;");
-if (context.global.b == Gtk.WindowType.NORMAL){
-   Seed.print("Everything works!");
-}
-</pre>
-</body>
-</html>
diff --git a/doc/modules/sandbox/sandbox.js b/doc/modules/sandbox/sandbox.js
new file mode 100644
index 0000000..b3a1afc
--- /dev/null
+++ b/doc/modules/sandbox/sandbox.js
@@ -0,0 +1,19 @@
+funcs = [{id: "sandbox-context",
+	  title: "new sandbox.Context()",
+	  description: "Creates a new sandbox context object, which wraps a Seed JavaScript context with it's own global object. By default this global object contains only default JSCore globals (Array, Object, etc...) and has no ability to interact with the outside system. Note the context must be manually destroyed with the <parameter>destroy</parameter> method."},
+	 {id: "sandbox-eval",
+	  title: "context.eval(source)",
+	  description: "Evaluates a string <parameter>source</parameter> with context, returns the result.",
+	  params: [
+	      {name: "source", description: "The code to evaluate"}
+	  ]},
+	 {id: "sandbox-addglobals",
+	  title: "context.add_globals()",
+	  description: "Adds the default Seed globals to the context, including the 'Seed' global object, and the imports object."},
+	 {id: "sandbox-destroy",
+	  title: "context.destroy()",
+	  description: "Destroys the internal context object, and any further usage of the wrapper is an exception"},
+	 {id: "sandbox-global",
+	  title: "context.global",
+	  description: "A project, representing the literal global object of the context, may be freely read from and assigned to"}]
+	 
diff --git a/doc/modules/sandbox/sandbox.xml b/doc/modules/sandbox/sandbox.xml
new file mode 100644
index 0000000..1b6fb2b
--- /dev/null
+++ b/doc/modules/sandbox/sandbox.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<chapter id="Sandbox-module" xmlns:xi="http://www.w3.org/2003/XInclude";>
+    <chapterinfo>
+    <author>
+      <firstname>Robert</firstname>
+      <surname>Carr</surname>
+      <affiliation>
+	<address>
+	  <email>racarr@<parameter>gnome.org</parameter></email>
+	</address>
+      </affiliation>
+    </author>
+  </chapterinfo>
+  <title>Sandbox module.</title>
+
+  <section>
+    <title>API Reference</title>
+    <para>
+      The sandbox module allows the creation of isolated JSCore contexts with individual global objects. It is useful as a literal "sandbox" or in a variety of other contexts. 
+      <programlisting>
+	sandbox = imports.sandbox;
+      </programlisting>
+    </para>
+    
+    <xi:include href="sandbox-funcs.xml"/>
+  </section>
+  <section>
+    <title>Examples</title>
+    <para>Below are several examples of using the Seed Sandbox module. For additional resources, consult the examples/ folder of the Seed source</para>
+    <example id="sandbox-example">
+      <programlisting>
+sandbox = imports.sandbox;
+
+ctx = new sandbox.Context();
+ctx.eval("b = 2+2");
+Seed.print(ctx.global.b); //4
+ctx.global.b = new Gtk.Window(); // Possible to expose objects to the context.
+ctx.eval("b.show()");
+
+      </programlisting>
+    </example>
+  </section>
+</chapter>
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]