/
usr
/
share
/
doc
/
libjs-codemirror
/
examples
/
/usr/share/doc/libjs-codemirror/examples
mkdir
upload
Name
Size
Mode
Actions
activeline.html
3343
0644
edit
dl
rm
anywordhint.html
2937
0644
edit
dl
rm
bidi.html
5000
0644
edit
dl
rm
btree.html
3008
0644
edit
dl
rm
buffers.html
3674
0644
edit
dl
rm
changemode.html
1825
0644
edit
dl
rm
closebrackets.html
1763
0644
edit
dl
rm
closetag.html
1619
0644
edit
dl
rm
complete.html
4504
0644
edit
dl
rm
emacs.html
2823
0644
edit
dl
rm
folding.html
6270
0644
edit
dl
rm
fullscreen.html
3617
0644
edit
dl
rm
hardwrap.html
2681
0644
edit
dl
rm
html5complete.html
2033
0644
edit
dl
rm
indentwrap.html
2687
0644
edit
dl
rm
loadmode.html
2362
0644
edit
dl
rm
marker.html
1563
0644
edit
dl
rm
markselection.html
1985
0644
edit
dl
rm
matchhighlighter.html
5007
0644
edit
dl
rm
matchtags.html
1512
0644
edit
dl
rm
multiplex.html
2303
0644
edit
dl
rm
mustache.html
2233
0644
edit
dl
rm
panel.html
3654
0644
edit
dl
rm
placeholder.html
1586
0644
edit
dl
rm
preview.html
2601
0644
edit
dl
rm
requirejs.html
2328
0644
edit
dl
rm
resize.html
1437
0644
edit
dl
rm
rulers.html
1483
0644
edit
dl
rm
runmode-standalone.html
2356
0644
edit
dl
rm
runmode.html
2420
0644
edit
dl
rm
search.html
5010
0644
edit
dl
rm
simplemode.html
8332
0644
edit
dl
rm
simplescrollbars.html
5227
0644
edit
dl
rm
spanaffectswrapping_shim.html
3073
0644
edit
dl
rm
sublime.html
3311
0644
edit
dl
rm
theme.html
7680
0644
edit
dl
rm
trailingspace.html
1646
0644
edit
dl
rm
variableheight.html
2175
0644
edit
dl
rm
vim.html
4428
0644
edit
dl
rm
visibletabs.html
1940
0644
edit
dl
rm
xmlcomplete.html
3872
0644
edit
dl
rm
Edit:
/usr/share/doc/libjs-codemirror/examples/mustache.html
(2233B)
<!doctype html> <title>CodeMirror: Overlay Parser Demo</title> <meta charset="utf-8"/> <link rel=stylesheet href="../html/docs.css"> <link rel="stylesheet" href="/usr/share/javascript/codemirror/lib/codemirror.css"> <script src="/usr/share/javascript/codemirror/lib/codemirror.js"></script> <script src="/usr/share/javascript/codemirror/addon/mode/overlay.js"></script> <script src="/usr/share/javascript/codemirror/mode/xml/xml.js"></script> <style> .CodeMirror {border: 1px solid black;} .cm-mustache {color: #0ca;} </style> <div id=nav> <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../html/logo.png"></a> <ul> <li><a href="../index.html">Home</a> <li><a href="../html/manual.html">Manual</a> <li><a href="https://github.com/codemirror/codemirror">Code</a> </ul> <ul> <li><a class=active href="#">Overlay Parser</a> </ul> </div> <article> <h2>Overlay Parser Demo</h2> <form><textarea id="code" name="code"> <html> <body> <h1>{{title}}</h1> <p>These are links to {{things}}:</p> <ul>{{#links}} <li><a href="{{url}}">{{text}}</a></li> {{/links}}</ul> </body> </html> </textarea></form> <script> CodeMirror.defineMode("mustache", function(config, parserConfig) { var mustacheOverlay = { token: function(stream, state) { var ch; if (stream.match("{{")) { while ((ch = stream.next()) != null) if (ch == "}" && stream.next() == "}") { stream.eat("}"); return "mustache"; } } while (stream.next() != null && !stream.match("{{", false)) {} return null; } }; return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay); }); var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "mustache"}); </script> <p>Demonstration of a mode that parses HTML, highlighting the <a href="http://mustache.github.io/">Mustache</a> templating directives inside of it by using the code in <a href="/usr/share/javascript/codemirror/addon/mode/overlay.js"><code>overlay.js</code></a>. View source to see the 15 lines of code needed to accomplish this.</p> </article>
Save
cmd:
run