1 |
|
2 | <html>
|
3 | <head>
|
4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5 | <style type="text/css">
|
6 | /*
|
7 | Copyright (c) 2010, Yahoo! Inc. All rights reserved.
|
8 | Code licensed under the BSD License:
|
9 | http://developer.yahoo.com/yui/license.html
|
10 | version: 3.2.0
|
11 | build: 2676
|
12 | */
|
13 | html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
|
14 |
|
15 | /*
|
16 | * Custom styles
|
17 | */
|
18 | body {
|
19 | width: 100%;
|
20 | overflow: hidden;
|
21 | }
|
22 | #parse {
|
23 | border: none;
|
24 | background-color: white;
|
25 | color: black;
|
26 | z-index: 3;
|
27 | position: absolute;
|
28 | right: 50%;
|
29 | top: 0;
|
30 | width: 100px;
|
31 | }
|
32 | #yaml {
|
33 | color: white;
|
34 | background-color: black;
|
35 | font-family: "Courier New";
|
36 | font-size: 14px;
|
37 | width: 50%;
|
38 | border: none;
|
39 | position: absolute;
|
40 | top: 0;
|
41 | left: 0;
|
42 | z-index: 1;
|
43 | height: 100%;
|
44 | }
|
45 | #result {
|
46 | color: black;
|
47 | background-color: white;
|
48 | font-family: "Courier New";
|
49 | font-size: 15px;
|
50 | width: 50%;
|
51 | border: none;
|
52 | position: absolute;
|
53 | top: 5em;
|
54 | left: 50%;
|
55 | overflow: auto;
|
56 | z-index: 2;
|
57 | height: 100%;
|
58 | }
|
59 | #tests {
|
60 | width: 50%;
|
61 | border: none;
|
62 | position: absolute;
|
63 | top: 0;
|
64 | left: 50%;
|
65 | z-index: 2;
|
66 | }
|
67 | </style>
|
68 |
|
69 | <!-- standalone yaml.js library -->
|
70 | <script type="text/javascript" src="../bin/yaml.js"></script>
|
71 |
|
72 | <title>yaml.js demo</title>
|
73 | </head>
|
74 |
|
75 | <body>
|
76 | <form action="" onsubmit="return false;">
|
77 | <textarea name="yaml" id="yaml" cols="70" rows="20">--- !clarkevans.com/^invoice
|
78 | invoice: 34843
|
79 | date : 2001-01-23
|
80 | bill-to: &id001
|
81 | given : Chris
|
82 | family : Dumars
|
83 | address:
|
84 | lines: |
|
85 | 458 Walkman Dr.
|
86 | Suite #292
|
87 | city : Royal Oak
|
88 | state : MI
|
89 | postal : 48046
|
90 | ship-to: *id001
|
91 | product:
|
92 | - sku : "BL394D"
|
93 | quantity : 4
|
94 | description : Basketball
|
95 | price : 450.00
|
96 | - sku : BL4438H
|
97 | quantity : 1
|
98 | description : Super Hoop
|
99 | price : 2392.00
|
100 | tax : 251.42
|
101 | total: 4443.52
|
102 | comments: >
|
103 | Late afternoon is best.
|
104 | Backup contact is Nancy
|
105 | Billsmer @ 338-4338.
|
106 | </textarea>
|
107 | <input type="button" id="parse" name="parse" value="Parse »" onclick="try{document.getElementById('result').innerHTML=JSON.stringify(YAML.parse(document.getElementById('yaml').value))}catch(e){alert(e);}" />
|
108 | <div id="tests"><span>You could also try to run some <a href="tests.html" title="Jasmine tests">javascript tests</a> based on <a href="http://www.yaml.org/YAML_for_ruby.html">YAML cookbook for Ruby</a>. All tests should pass. Those that don't are commented out; they deal with multiple YAML documents in one stream which is not supported by yaml.js (and Symfony)</span></div>
|
109 | <div id="result"></div>
|
110 |
|
111 | </form>
|
112 | </body>
|
113 | </html> |
\ | No newline at end of file |