summaryrefslogtreecommitdiff
path: root/demo.html
blob: cbff773ea19f62cacb88af52822fc3224c5dbdae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<style type="text/css">
	/*
	Copyright (c) 2010, Yahoo! Inc. All rights reserved.
	Code licensed under the BSD License:
	http://developer.yahoo.com/yui/license.html
	version: 3.2.0
	build: 2676
	*/
	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;}
	
	/*
	 * Custom styles
	 */
	body {
		width: 100%;
		overflow: hidden;
	}
	#parse {
		border: none;
		background-color: white;
		color: black;
		z-index: 3;
		position: absolute;
		right: 50%;
		top: 0;
		width: 100px;
	}
	#yaml {
		color: white;
		background-color: black;
		font-family: "Courier New";
		font-size: 14px;
		width: 50%;
		border: none;
		position: absolute;
		top: 0;
		left: 0;
		z-index: 1;
		height: 100%;
	}
	#result {
		color: black;
		background-color: white;
		font-family: "Courier New";
		font-size: 15px;
		width: 50%;		
		border: none;
		position: absolute;
		top: 5em;
		left: 50%;
		overflow: auto;
		z-index: 2;
		height: 100%;
	}
	#tests {
		width: 50%;		
		border: none;
		position: absolute;
		top: 0;
		left: 50%;
		z-index: 2;
	}
	</style>
	
	<!-- standalone yaml.js library -->
	<script type="text/javascript" src="yaml.js"></script>
		
	<title>yaml.js demo</title>
</head>

<body>
<form action="" onsubmit="return false;">
	<textarea name="yaml" id="yaml" cols="70" rows="20">--- !clarkevans.com/^invoice
invoice: 34843
date   : 2001-01-23
bill-to: &amp;id001
    given  : Chris
    family : Dumars
    address:
        lines: |
            458 Walkman Dr.
            Suite #292
        city    : Royal Oak
        state   : MI
        postal  : 48046
ship-to: *id001
product:
    - sku         : &quot;BL394D&quot;
      quantity    : 4
      description : Basketball
      price       : 450.00
    - sku         : BL4438H
      quantity    : 1
      description : Super Hoop
      price       : 2392.00
tax  : 251.42
total: 4443.52
comments: &gt;
    Late afternoon is best.
    Backup contact is Nancy
    Billsmer @ 338-4338.
</textarea>
<input type="button" id="parse" name="parse" value="Parse &raquo;" onclick="try{document.getElementById('result').innerHTML=JSON.stringify(YAML.decode(document.getElementById('yaml').value))}catch(e){alert(e);}" />
<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 jaml.js (and Symfony)</span></div>
<div id="result"></div>

</form>
</body>
</html>