]> Dogcows Code - chaz/p5-CGI-Ex/blobdiff - samples/yaml_js_1.html
CGI::Ex 2.00
[chaz/p5-CGI-Ex] / samples / yaml_js_1.html
diff --git a/samples/yaml_js_1.html b/samples/yaml_js_1.html
new file mode 100644 (file)
index 0000000..263d16a
--- /dev/null
@@ -0,0 +1,62 @@
+<html>
+<title>Yaml Test</title>
+<body>
+
+<table border=1 cellspacing=0>
+  <tr>
+    <td colspan=2>
+<script src="../lib/CGI/Ex/yaml_load.js"></script>
+<script>
+
+if (! document.yaml_load) {
+  document.writeln('<span style="color:red"><h1>Missing document.yaml_load</h1>Path to ../lib/CGI/Ex/yaml_load.js may be invalid.</span>');
+} else {
+  document.writeln('<span style="color:green"><h1>Found document.yaml_load</h1></span>');
+}
+
+</script>
+    </td>
+  </tr>
+
+  <tr><th colspan=2>YAML text</th></tr>
+  <tr>
+    <td colspan=2>
+<pre><script>
+var yaml = "foo: bar\nbaz: bee\nhem: haw\n";
+document.write(yaml)
+</script></pre>
+    </td>
+  </tr>
+
+
+  <tr>
+    <th>Produces</th><th>Should look like</th>
+  </tr>
+  <tr>
+    <td>
+<pre><script>
+var t1 = new Date();
+var y  = document.yaml_load(yaml)
+var t2 = new Date();
+document.write(document.js_dump(y));
+</script></pre>
+    </td>
+    <td>
+<pre>Dump:
+[obj].0.baz=bee
+[obj].0.foo=bar
+[obj].0.hem=haw
+</pre>
+    </td>
+  </tr>
+
+  <tr>
+    <td colspan=2>
+<script>
+document.write("Elapsed time: "+((t2.getTime() - t1.getTime())/1000)+" seconds");
+</script>
+    </td>
+  </tr>
+
+</body>
+</html>
\ No newline at end of file
This page took 0.020466 seconds and 4 git commands to generate.