Merge branch '2.0'
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / js / 3rdParty / codemirror / mode / htmlmixed / index.html
1 <!doctype html>
2
3 <title>CodeMirror: HTML mixed mode</title>
4 <meta charset="utf-8"/>
5 <link rel=stylesheet href="../../doc/docs.css">
6
7 <link rel="stylesheet" href="../../lib/codemirror.css">
8 <script src="../../lib/codemirror.js"></script>
9 <script src="../xml/xml.js"></script>
10 <script src="../javascript/javascript.js"></script>
11 <script src="../css/css.js"></script>
12 <script src="../vbscript/vbscript.js"></script>
13 <script src="htmlmixed.js"></script>
14 <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
15 <div id=nav>
16 <a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
17
18 <ul>
19 <li><a href="../../index.html">Home</a>
20 <li><a href="../../doc/manual.html">Manual</a>
21 <li><a href="https://github.com/marijnh/codemirror">Code</a>
22 </ul>
23 <ul>
24 <li><a href="../index.html">Language modes</a>
25 <li><a class=active href="#">HTML mixed</a>
26 </ul>
27 </div>
28
29 <article>
30 <h2>HTML mixed mode</h2>
31 <form><textarea id="code" name="code">
32 <html style="color: green">
33 <!-- this is a comment -->
34 <head>
35 <title>Mixed HTML Example</title>
36 <style type="text/css">
37 h1 {font-family: comic sans; color: #f0f;}
38 div {background: yellow !important;}
39 body {
40 max-width: 50em;
41 margin: 1em 2em 1em 5em;
42 }
43 </style>
44 </head>
45 <body>
46 <h1>Mixed HTML Example</h1>
47 <script>
48 function jsFunc(arg1, arg2) {
49 if (arg1 && arg2) document.body.innerHTML = "achoo";
50 }
51 </script>
52 </body>
53 </html>
54 </textarea></form>
55 <script>
56 // Define an extended mixed-mode that understands vbscript and
57 // leaves mustache/handlebars embedded templates in html mode
58 var mixedMode = {
59 name: "htmlmixed",
60 scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
61 mode: null},
62 {matches: /(text|application)\/(x-)?vb(a|script)/i,
63 mode: "vbscript"}]
64 };
65 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: mixedMode});
66 </script>
67
68 <p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
69
70 <p>It takes an optional mode configuration
71 option, <code>scriptTypes</code>, which can be used to add custom
72 behavior for specific <code>&lt;script type="..."></code> tags. If
73 given, it should hold an array of <code>{matches, mode}</code>
74 objects, where <code>matches</code> is a string or regexp that
75 matches the script type, and <code>mode</code> is
76 either <code>null</code>, for script types that should stay in
77 HTML mode, or a <a href="../../doc/manual.html#option_mode">mode
78 spec</a> corresponding to the mode that should be used for the
79 script.</p>
80
81 <p><strong>MIME types defined:</strong> <code>text/html</code>
82 (redefined, only takes effect if you load this parser after the
83 XML parser).</p>
84
85 </article>