demo.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <!DOCTYPE html>
  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. * Custom styles
  16. */
  17. body {
  18. width: 100%;
  19. overflow: hidden;
  20. }
  21. #parse {
  22. border: none;
  23. background-color: white;
  24. color: black;
  25. z-index: 3;
  26. position: absolute;
  27. right: 50%;
  28. top: 0;
  29. width: 100px;
  30. }
  31. #yaml {
  32. color: white;
  33. background-color: black;
  34. font-family: "Courier New";
  35. font-size: 14px;
  36. width: 50%;
  37. border: none;
  38. position: absolute;
  39. top: 0;
  40. left: 0;
  41. z-index: 1;
  42. height: 100%;
  43. }
  44. #result {
  45. color: black;
  46. background-color: white;
  47. font-family: "Courier New";
  48. font-size: 12px;
  49. width: 50%;
  50. border: none;
  51. position: absolute;
  52. top: 0;
  53. left: 50%;
  54. overflow: auto;
  55. z-index: 2;
  56. height: 100%;
  57. vertical-align: top;
  58. overflow: auto;
  59. }
  60. #tests {
  61. width: 50%;
  62. border: none;
  63. position: absolute;
  64. top: 0;
  65. left: 50%;
  66. z-index: 2;
  67. }
  68. </style>
  69. <!-- standalone yaml.js library -->
  70. <script type="text/javascript" src="../dist/yaml.debug.js"></script>
  71. <title>yaml.js demo</title>
  72. </head>
  73. <body>
  74. <form action="" onsubmit="return false;">
  75. <textarea name="yaml" id="yaml" cols="70" rows="20">--- !clarkevans.com/^invoice
  76. invoice: 34843
  77. date : 2001-01-23
  78. bill-to: &amp;id001
  79. given : Chris
  80. family : Dumars
  81. address:
  82. lines: |
  83. 458 Walkman Dr.
  84. Suite #292
  85. city : Royal Oak
  86. state : MI
  87. postal : 48046
  88. ship-to: *id001
  89. product:
  90. - sku : &quot;BL394D&quot;
  91. quantity : 4
  92. description : Basketball
  93. price : 450.00
  94. - sku : BL4438H
  95. quantity : 1
  96. description : Super Hoop
  97. price : 2392.00
  98. tax : 251.42
  99. total: 4443.52
  100. comments: &gt;
  101. Late afternoon is best.
  102. Backup contact is Nancy
  103. Billsmer @ 338-4338.
  104. </textarea>
  105. <input type="button" id="parse" name="parse" value="Parse &raquo;" onclick="document.getElementById('result').innerHTML='<pre>'+JSON.stringify(YAML.parse(document.getElementById('yaml').value), null, 4)+'</pre>'" />
  106. <div id="result"></div>
  107. </form>
  108. </body>
  109. </html>