]> Dogcows Code - chaz/p5-CGI-Ex/blobdiff - samples/yaml_js_2.html
CGI::Ex 2.00
[chaz/p5-CGI-Ex] / samples / yaml_js_2.html
diff --git a/samples/yaml_js_2.html b/samples/yaml_js_2.html
new file mode 100644 (file)
index 0000000..faf32cc
--- /dev/null
@@ -0,0 +1,114 @@
+<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 = "--- #YAML:1.0\n\
+- foo1: bar1\n\
+  foo2: {key1: val1, key2: 'value 2'}\n\
+  foo3:\n\
+   - a\n\
+   - list\n\
+   - of\n\
+   - items\n\
+   - 'with the last item being a long string'\n\
+  foo4: [another, list, of, values]\n\
+  foo5a: |\n\
+   A block of text\n\
+   that is on multiple lines.\n\
+  foo5b: |+\n\
+   A block\n\
+   of text\n\
+    that is on\n\
+   multiple lines.\n\
+  foo6a: >\n\
+   A block\n\
+   of text\n\
+    that is on\n\
+   multiple lines and is folded.\n\
+  foo6b: >+\n\
+   A block\n\
+   of text\n\
+    that is on\n\
+   multiple lines and is folded.\n\
+  foo7: 'singlequoted''with embedded quote'\n\
+  foo8: \"doublequoted\\\"with embedded quote\"\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.0.foo1=bar1
+[obj].0.0.foo2.key1=val1
+[obj].0.0.foo2.key2=value 2
+[obj].0.0.foo3.0=a
+[obj].0.0.foo3.1=list
+[obj].0.0.foo3.2=of
+[obj].0.0.foo3.3=items
+[obj].0.0.foo3.4=with the last item being a long string
+[obj].0.0.foo4.0=another
+[obj].0.0.foo4.1=list
+[obj].0.0.foo4.2=of
+[obj].0.0.foo4.3=values
+[obj].0.0.foo5a=A block of text
+that is on multiple lines.
+[obj].0.0.foo5b=A block
+of text
+ that is on
+multiple lines.
+
+[obj].0.0.foo6a=A block of text that is on multiple lines and is folded.
+[obj].0.0.foo6b=A block of text that is on multiple lines and is folded.
+
+[obj].0.0.foo7=singlequoted'with embedded quote
+[obj].0.0.foo8=doublequoted"with embedded quote
+</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.02162 seconds and 4 git commands to generate.