comparison rhodecode/public/js/mode/xquery/index.html @ 4029:c9bcfe2d2ade

codecleaner
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 21 Jun 2013 01:11:16 +0200
parents a60a0e9092c6
children
comparison
equal deleted inserted replaced
4028:c3245a0452a3 4029:c9bcfe2d2ade
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <!-- 3 <!--
4 /* 4 /*
5 Copyright (C) 2011 by MarkLogic Corporation 5 Copyright (C) 2011 by MarkLogic Corporation
6 Author: Mike Brevoort <mike@brevoort.com> 6 Author: Mike Brevoort <mike@brevoort.com>
7 7
22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 THE SOFTWARE. 24 THE SOFTWARE.
25 */ 25 */
26 --> 26 -->
27 <head> 27 <head>
28 <meta charset="utf-8"> 28 <meta charset="utf-8">
29 <title>CodeMirror: XQuery mode</title> 29 <title>CodeMirror: XQuery mode</title>
30 <link rel="stylesheet" href="../../lib/codemirror.css"> 30 <link rel="stylesheet" href="../../lib/codemirror.css">
31 <script src="../../lib/codemirror.js"></script> 31 <script src="../../lib/codemirror.js"></script>
32 <script src="xquery.js"></script> 32 <script src="xquery.js"></script>
33 <link rel="stylesheet" href="../../doc/docs.css"> 33 <link rel="stylesheet" href="../../doc/docs.css">
34 <link rel="stylesheet" href="../../theme/xq-dark.css"> 34 <link rel="stylesheet" href="../../theme/xq-dark.css">
35 <style type="text/css"> 35 <style type="text/css">
36 .CodeMirror { 36 .CodeMirror {
37 border-top: 1px solid black; border-bottom: 1px solid black; 37 border-top: 1px solid black; border-bottom: 1px solid black;
38 height:400px; 38 height:400px;
39 } 39 }
40 </style> 40 </style>
41 </head> 41 </head>
42 <body> 42 <body>
43 <h1>CodeMirror: XQuery mode</h1> 43 <h1>CodeMirror: XQuery mode</h1>
44 44
45 <div class="cm-s-default"> 45 <div class="cm-s-default">
46 <textarea id="code" name="code"> 46 <textarea id="code" name="code">
47 xquery version &quot;1.0-ml&quot;; 47 xquery version &quot;1.0-ml&quot;;
48 (: this is 48 (: this is
49 : a 49 : a
50 "comment" :) 50 "comment" :)
51 let $let := &lt;x attr=&quot;value&quot;&gt;&quot;test&quot;&lt;func&gt;function() $var {function()} {$var}&lt;/func&gt;&lt;/x&gt; 51 let $let := &lt;x attr=&quot;value&quot;&gt;&quot;test&quot;&lt;func&gt;function() $var {function()} {$var}&lt;/func&gt;&lt;/x&gt;
52 let $joe:=1 52 let $joe:=1
53 return element element { 53 return element element {
54 attribute attribute { 1 }, 54 attribute attribute { 1 },
55 element test { &#39;a&#39; }, 55 element test { &#39;a&#39; },
56 attribute foo { &quot;bar&quot; }, 56 attribute foo { &quot;bar&quot; },
57 fn:doc()[ foo/@bar eq $let ], 57 fn:doc()[ foo/@bar eq $let ],
58 //x } 58 //x }
59 59
60 (: a more 'evil' test :) 60 (: a more 'evil' test :)
61 (: Modified Blakeley example (: with nested comment :) ... :) 61 (: Modified Blakeley example (: with nested comment :) ... :)
62 declare private function local:declare() {()}; 62 declare private function local:declare() {()};
63 declare private function local:private() {()}; 63 declare private function local:private() {()};
64 declare private function local:function() {()}; 64 declare private function local:function() {()};
65 declare private function local:local() {()}; 65 declare private function local:local() {()};
66 let $let := &lt;let&gt;let $let := &quot;let&quot;&lt;/let&gt; 66 let $let := &lt;let&gt;let $let := &quot;let&quot;&lt;/let&gt;
67 return element element { 67 return element element {
68 attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } }, 68 attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } },
69 attribute fn:doc { &quot;bar&quot; castable as xs:string }, 69 attribute fn:doc { &quot;bar&quot; castable as xs:string },
70 element text { text { &quot;text&quot; } }, 70 element text { text { &quot;text&quot; } },
71 fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ], 71 fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ],
72 //fn:doc 72 //fn:doc
73 } 73 }
74 74
75 75
76 76
77 xquery version &quot;1.0-ml&quot;; 77 xquery version &quot;1.0-ml&quot;;
191 @param $x Element node to convert 191 @param $x Element node to convert
192 @return String holding JSON serialized representation of $x 192 @return String holding JSON serialized representation of $x
193 193
194 @author Jason Hunter 194 @author Jason Hunter
195 @version 1.0.1 195 @version 1.0.1
196 196
197 Ported to xquery 1.0-ml; double escaped backslashes in json:escape 197 Ported to xquery 1.0-ml; double escaped backslashes in json:escape
198 :) 198 :)
199 declare function json:serialize($x as element()) as xs:string { 199 declare function json:serialize($x as element()) as xs:string {
200 string-join(('{', json:print-name-value($x), '}'), &quot;&quot;) 200 string-join(('{', json:print-name-value($x), '}'), &quot;&quot;)
201 }; 201 };
202 </textarea> 202 </textarea>
203 </div> 203 </div>
204 204
205 <script> 205 <script>
206 var editor = CodeMirror.fromTextArea(document.getElementById("code"), { 206 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
207 lineNumbers: true, 207 lineNumbers: true,
208 matchBrackets: true, 208 matchBrackets: true,
209 theme: "xq-dark" 209 theme: "xq-dark"
210 }); 210 });
211 </script> 211 </script>
212 212
213 <p><strong>MIME types defined:</strong> <code>application/xquery</code>.</p> 213 <p><strong>MIME types defined:</strong> <code>application/xquery</code>.</p>
214 214
215 <p>Development of the CodeMirror XQuery mode was sponsored by 215 <p>Development of the CodeMirror XQuery mode was sponsored by
216 <a href="http://marklogic.com">MarkLogic</a> and developed by 216 <a href="http://marklogic.com">MarkLogic</a> and developed by
217 <a href="https://twitter.com/mbrevoort">Mike Brevoort</a>. 217 <a href="https://twitter.com/mbrevoort">Mike Brevoort</a>.
218 </p> 218 </p>
219 219
220 </body> 220 </body>
221 </html> 221 </html>