openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

multiplex.html (2164B)


      1 <!doctype html>
      2 
      3 <title>CodeMirror: Multiplexing Parser Demo</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="../addon/mode/multiplex.js"></script>
     10 <script src="../mode/xml/xml.js"></script>
     11 <style type="text/css">
     12       .CodeMirror {border: 1px solid black;}
     13       .cm-delimit {color: #fa4;}
     14     </style>
     15 <div id=nav>
     16   <a href="http://codemirror.net"><h1>CodeMirror</h1><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/codemirror/codemirror">Code</a>
     22   </ul>
     23   <ul>
     24     <li><a class=active href="#">Multiplexing Parser</a>
     25   </ul>
     26 </div>
     27 
     28 <article>
     29 <h2>Multiplexing Parser Demo</h2>
     30 <form><textarea id="code" name="code">
     31 <html>
     32   <body style="<<magic>>">
     33     <h1><< this is not <html >></h1>
     34     <<
     35         multiline
     36         not html
     37         at all : &amp;amp; <link/>
     38     >>
     39     <p>this is html again</p>
     40   </body>
     41 </html>
     42 </textarea></form>
     43 
     44     <script>
     45 CodeMirror.defineMode("demo", function(config) {
     46   return CodeMirror.multiplexingMode(
     47     CodeMirror.getMode(config, "text/html"),
     48     {open: "<<", close: ">>",
     49      mode: CodeMirror.getMode(config, "text/plain"),
     50      delimStyle: "delimit"}
     51     // .. more multiplexed styles can follow here
     52   );
     53 });
     54 var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
     55   mode: "demo",
     56   lineNumbers: true,
     57   lineWrapping: true
     58 });
     59 </script>
     60 
     61     <p>Demonstration of a multiplexing mode, which, at certain
     62     boundary strings, switches to one or more inner modes. The out
     63     (HTML) mode does not get fed the content of the <code>&lt;&lt;
     64     >></code> blocks. See
     65     the <a href="../doc/manual.html#addon_multiplex">manual</a> and
     66     the <a href="../addon/mode/multiplex.js">source</a> for more
     67     information.</p>
     68 
     69     <p>
     70       <strong>Parsing/Highlighting Tests:</strong>
     71       <a href="../test/index.html#multiplexing_*">normal</a>,
     72       <a href="../test/index.html#verbose,multiplexing_*">verbose</a>.
     73     </p>
     74 
     75   </article>