-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 2.0.0-alpha # Conflicts: # lib/jdists.js # lib/scope.js # package.json
- Loading branch information
Showing
8 changed files
with
116 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,9 @@ | |
}, | ||
"xor": { | ||
"encoding": "xor" | ||
}, | ||
"toggle": { | ||
"encoding": "toggle" | ||
} | ||
}, | ||
"processors": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* 注释块切换 | ||
* | ||
* @param {string} content 文本内容 | ||
* @param {Object} attrs 属性 | ||
* @param {Object} scope 作用域 | ||
* @param {Object} node 当前节点 | ||
*/ | ||
module.exports = function processor(content, attr, scope, node) { | ||
if (!content || node.type != 'block') { | ||
return content; | ||
} | ||
|
||
var lang = { | ||
'c': { | ||
prefix: '/*<', | ||
suffix: '>*/', | ||
}, | ||
'pascal': { | ||
prefix: '(*<', | ||
suffix: '>*)', | ||
}, | ||
'lua': { | ||
prefix: '--[[<', | ||
suffix: '>]]', | ||
}, | ||
'python': { | ||
prefix: "'''<", | ||
suffix: ">'''", | ||
}, | ||
'xml': { | ||
prefix: "<!--", | ||
suffix: "-->", | ||
}, | ||
}[node.language]; | ||
|
||
if (node.comment) { | ||
return node.prefix.slice(0, -1) + lang.suffix + node.content + lang.prefix + node.suffix.slice(1); | ||
} | ||
return node.prefix.slice(0, -lang.suffix.length) + '>' + node.content + '<' + node.suffix.slice(lang.prefix.length); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!--jdists encoding="toggle" /--> | ||
<!--jdists encoding="toggle"> | ||
xml Off | ||
</jdists--> | ||
<!--jdists encoding="toggle"--> | ||
xml On | ||
<!--/jdists--> | ||
/*<jdists encoding="toggle"> | ||
c Off | ||
</jdists>*/ | ||
/*<jdists encoding="toggle">*/ | ||
c On | ||
/*</jdists>*/ | ||
(*<jdists encoding="toggle"> | ||
pascal Off | ||
</jdists>*) | ||
(*<jdists encoding="toggle">*) | ||
pascal On | ||
(*</jdists>*) | ||
'''<jdists encoding="toggle"> | ||
python Off | ||
</jdists>''' | ||
'''<jdists encoding="toggle">''' | ||
python On | ||
'''</jdists>''' | ||
--[[<jdists encoding="toggle"> | ||
lua Off | ||
</jdists>]] | ||
--[[<jdists encoding="toggle">]] | ||
lua On | ||
--[[</jdists>]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
<!--jdists encoding="toggle"--> | ||
xml Off | ||
<!--/jdists--> | ||
<!--jdists encoding="toggle"> | ||
xml On | ||
</jdists--> | ||
/*<jdists encoding="toggle">*/ | ||
c Off | ||
/*</jdists>*/ | ||
/*<jdists encoding="toggle"> | ||
c On | ||
</jdists>*/ | ||
(*<jdists encoding="toggle">*) | ||
pascal Off | ||
(*</jdists>*) | ||
(*<jdists encoding="toggle"> | ||
pascal On | ||
</jdists>*) | ||
'''<jdists encoding="toggle">''' | ||
python Off | ||
'''</jdists>''' | ||
'''<jdists encoding="toggle"> | ||
python On | ||
</jdists>''' | ||
--[[<jdists encoding="toggle">]] | ||
lua Off | ||
--[[</jdists>]] | ||
--[[<jdists encoding="toggle"> | ||
lua On | ||
</jdists>]] |