Skip to content

Commit

Permalink
Also provide an undecorated PHP mode
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Jun 6, 2011
1 parent d0dfa2f commit 5b13e5c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mode/php/index.html
Expand Up @@ -47,6 +47,6 @@ <h1>CodeMirror 2: PHP mode</h1>
the <a href="../clike/">C-like</a> mode. Depends on XML,
JavaScript, CSS, and C-like modes.</p>

<p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code>.</p>
<p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code> (HTML with PHP code), <code>text/x-php</code> (plain, non-wrapped PHP code).</p>
</body>
</html>
7 changes: 4 additions & 3 deletions mode/php/php.js
Expand Up @@ -9,12 +9,13 @@
"default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends " +
"final for foreach function global goto if implements interface instanceof namespace " +
"new or private protected public static switch throw try use var while xor");
var phpConfig = {name: "clike", keywords: phpKeywords, multiLineStrings: true, $vars: true};

CodeMirror.defineMode("php", function(config, parserConfig) {
var htmlMode = CodeMirror.getMode(config, "text/html");
var jsMode = CodeMirror.getMode(config, "text/javascript");
var cssMode = CodeMirror.getMode(config, "text/css");
var phpMode = CodeMirror.getMode(config, {name: "clike", keywords: phpKeywords, multiLineStrings: true, $vars: true});
var phpMode = CodeMirror.getMode(config, phpConfig);

function dispatch(stream, state) { // TODO open PHP inside text/css
if (state.curMode == htmlMode) {
Expand Down Expand Up @@ -78,6 +79,6 @@
electricChars: "/{}:"
}
});
CodeMirror.defineMIME("application/x-httpd-php", "php");
CodeMirror.defineMIME("text/x-php", phpConfig);
})();

CodeMirror.defineMIME("application/x-httpd-php", "php");

0 comments on commit 5b13e5c

Please sign in to comment.