| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <!doctype html> |
| <html> |
| <head> |
| <title>CodeMirror: LDPath Demo</title> |
| |
| <script type="text/javascript" src="../../../../../webjars/jquery/1.8.2/jquery.min.js"></script> |
| |
| <script type="text/javascript" src="../../../../../webjars/codemirror/3.16/lib/codemirror.js"></script> |
| <link rel="stylesheet" href="../../../../../webjars/codemirror/3.16/lib/codemirror.css"> |
| |
| <script src="../../../../../webjars/codemirror/3.16/addon/hint/show-hint.js"></script> |
| <link rel="stylesheet" href="../../../../../webjars/codemirror/3.16/addon/hint/show-hint.css"> |
| |
| <script src="ldpath.js"></script> |
| <link rel="stylesheet" href="ldpath.css"> |
| |
| </head> |
| <body> |
| <h1>CodeMirror: LDPath demo</h1> |
| <div> |
| Read about the <a href="http://marmotta.incubator.apache.org/ldpath/language.html" title="LDPath">LDPath Syntax</a> |
| in <a href="http://marmotta.incubator.apache.org/">Apache Marmotta</a>. |
| </div> |
| <div> |
| <button onclick="javascript:createEditor()">Editor</button> |
| <button onclick="javascript:removeEditor()">Plain</button> |
| </div> |
| <form> |
| <textarea id="code" name="code"> |
| @prefix iptc : <http://iptc.org/std/nar/2006-10-01/> ; |
| @prefix foaf ; |
| @prefix rss: ; |
| @prefix sioc: ; |
| @filter rdf:type is rss:item | rdf:type is isig:WebPage | rdf:type is sioc:Post ; |
| date = dc:date :: xsd:date(multiValued="false") ; |
| desc = dc:description[@de] :: lmf:text_en ; |
| feed = (^rss:items / rss:title | (page:partOf | sioc:has_container / dc:title)) :: xsd:string ; |
| lang = fn:first(^rss:items / dc:language, "de") :: xsd:string ; |
| summary = fn:removeTags((rss:description | dc:description)) :: lmf:text_en ; |
| title = (rss:title | (html:title | dc:title)) :: lmf:text_en ; |
| user = dc:creator :: xsd:string(multiValue="false") ; |
| </textarea> |
| </form> |
| <script> |
| var editor = null; |
| function createEditor() { |
| if (editor === null) { |
| CodeMirror.commands.autocomplete = function(cm) { |
| CodeMirror.showHint(cm, CodeMirror.hint.ldpath); |
| }; |
| editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
| lineNumbers : true, |
| matchBrackets : true, |
| extraKeys: {"Ctrl-Space": "autocomplete"}, |
| mode : "ldpath" |
| }); |
| } |
| } |
| function removeEditor() { |
| if (editor) { |
| editor.toTextArea(); |
| editor = null; |
| } |
| } |
| createEditor(); |
| </script> |
| </body> |
| </html> |