1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-27 08:40:10 +02:00

rename jad to pug. fixes #78

This commit is contained in:
Kushagra Gour
2017-02-19 23:39:28 +05:30
parent ebb3923ee5
commit e768d09fa5
3 changed files with 8 additions and 7 deletions

View File

@@ -45,7 +45,7 @@
<ul class="js-modes-menu dropdown__menu"> <ul class="js-modes-menu dropdown__menu">
<li><a data-type="html" data-mode="html">HTML</a></li> <li><a data-type="html" data-mode="html">HTML</a></li>
<li><a data-type="html" data-mode="markdown">Markdown</a></li> <li><a data-type="html" data-mode="markdown">Markdown</a></li>
<li><a data-type="html" data-mode="jade">Jade</a></li> <li><a data-type="html" data-mode="jade">Pug</a></li>
</ul> </ul>
</div> </div>
<div class="code-wrap__header-right-options"> <div class="code-wrap__header-right-options">

View File

@@ -11,7 +11,7 @@
})(function(CodeMirror) { })(function(CodeMirror) {
"use strict"; "use strict";
CodeMirror.defineMode('jade', function (config) { CodeMirror.defineMode("pug", function (config) {
// token types // token types
var KEYWORD = 'keyword'; var KEYWORD = 'keyword';
var DOCTYPE = 'meta'; var DOCTYPE = 'meta';
@@ -36,7 +36,7 @@ CodeMirror.defineMode('jade', function (config) {
this.isInterpolating = false; this.isInterpolating = false;
this.interpolationNesting = 0; this.interpolationNesting = 0;
this.jsState = jsMode.startState(); this.jsState = CodeMirror.startState(jsMode);
this.restOfLine = ''; this.restOfLine = '';
@@ -386,7 +386,7 @@ CodeMirror.defineMode('jade', function (config) {
if (state.inAttributeName && stream.match(/^[^=,\)!]+/)) { if (state.inAttributeName && stream.match(/^[^=,\)!]+/)) {
if (stream.peek() === '=' || stream.peek() === '!') { if (stream.peek() === '=' || stream.peek() === '!') {
state.inAttributeName = false; state.inAttributeName = false;
state.jsState = jsMode.startState(); state.jsState = CodeMirror.startState(jsMode);
if (state.lastTag === 'script' && stream.current().trim().toLowerCase() === 'type') { if (state.lastTag === 'script' && stream.current().trim().toLowerCase() === 'type') {
state.attributeIsType = true; state.attributeIsType = true;
} else { } else {
@@ -492,7 +492,7 @@ CodeMirror.defineMode('jade', function (config) {
if (stream.indentation() > state.indentOf || (state.innerModeForLine && !stream.sol()) || force) { if (stream.indentation() > state.indentOf || (state.innerModeForLine && !stream.sol()) || force) {
if (state.innerMode) { if (state.innerMode) {
if (!state.innerState) { if (!state.innerState) {
state.innerState = state.innerMode.startState ? state.innerMode.startState(stream.indentation()) : {}; state.innerState = state.innerMode.startState ? CodeMirror.startState(state.innerMode, stream.indentation()) : {};
} }
return stream.hideFirstChars(state.indentOf + 2, function () { return stream.hideFirstChars(state.indentOf + 2, function () {
return state.innerMode.token(stream, state.innerState) || true; return state.innerMode.token(stream, state.innerState) || true;
@@ -585,6 +585,7 @@ CodeMirror.defineMode('jade', function (config) {
}; };
}, 'javascript', 'css', 'htmlmixed'); }, 'javascript', 'css', 'htmlmixed');
CodeMirror.defineMIME('text/x-jade', 'jade'); CodeMirror.defineMIME('text/x-pug', 'pug');
CodeMirror.defineMIME('text/x-jade', 'pug');
}); });

View File

@@ -37,7 +37,7 @@ TextareaAutoComplete */
var modes = {}; var modes = {};
modes[HtmlModes.HTML] = { label: 'HTML', cmMode: 'htmlmixed', codepenVal: 'none' }; modes[HtmlModes.HTML] = { label: 'HTML', cmMode: 'htmlmixed', codepenVal: 'none' };
modes[HtmlModes.MARKDOWN] = { label: 'Markdown', cmMode: 'markdown', codepenVal: 'markdown' }; modes[HtmlModes.MARKDOWN] = { label: 'Markdown', cmMode: 'markdown', codepenVal: 'markdown' };
modes[HtmlModes.JADE] = { label: 'Jade', cmMode: 'jade', codepenVal: 'jade' }; modes[HtmlModes.JADE] = { label: 'Pug', cmMode: 'pug', codepenVal: 'pug' };
modes[JsModes.JS] = { label: 'JS', cmMode: 'javascript', codepenVal: 'none' }; modes[JsModes.JS] = { label: 'JS', cmMode: 'javascript', codepenVal: 'none' };
modes[JsModes.COFFEESCRIPT] = { label: 'CoffeeScript', cmMode: 'coffeescript', codepenVal: 'coffeescript' }; modes[JsModes.COFFEESCRIPT] = { label: 'CoffeeScript', cmMode: 'coffeescript', codepenVal: 'coffeescript' };
modes[JsModes.ES6] = { label: 'ES6 (Babel)', cmMode: 'jsx', codepenVal: 'babel' }; modes[JsModes.ES6] = { label: 'ES6 (Babel)', cmMode: 'jsx', codepenVal: 'babel' };