mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-01-14 01:07:55 -05:00
Compiled JavaScript files for improved literal mode.
This commit is contained in:
@@ -99,15 +99,18 @@
|
||||
};
|
||||
|
||||
exports.invertLiterate = function(code) {
|
||||
var line, lines, match;
|
||||
var line, lines, maybe_code;
|
||||
maybe_code = true;
|
||||
lines = (function() {
|
||||
var _i, _len, _ref1, _results;
|
||||
_ref1 = code.split('\n');
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
line = _ref1[_i];
|
||||
if (match = /^([ ]{4}|\t)/.exec(line)) {
|
||||
_results.push(line.slice(match[0].length));
|
||||
if (maybe_code && /^([ ]{4}|[ ]{0,3}\t)/.test(line)) {
|
||||
_results.push(line);
|
||||
} else if (maybe_code = /^\s*$/.test(line)) {
|
||||
_results.push(line);
|
||||
} else {
|
||||
_results.push('# ' + line);
|
||||
}
|
||||
|
||||
@@ -512,9 +512,6 @@
|
||||
if (indent) {
|
||||
doc = doc.replace(RegExp("\\n" + indent, "g"), '\n');
|
||||
}
|
||||
if (this.literate) {
|
||||
doc = doc.replace(/\n# \n/g, '\n\n');
|
||||
}
|
||||
if (!herecomment) {
|
||||
doc = doc.replace(/^\n/, '');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user