Skip to content

Commit

Permalink
fix inclusion of comments in sos-notebook JS code, too bad we cannot …
Browse files Browse the repository at this point in the history
…yet test JS code. vatlab/sos#976
  • Loading branch information
Bo Peng committed Jun 16, 2018
1 parent 7c51a4c commit 528b83a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sos_notebook/kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,14 @@ define([
} else if (lines[l].startsWith("#") || lines[l].startsWith("%") || lines[l].trim() === "" || lines[l].startsWith("!")) {
continue;
} else if (lines[l].startsWith("[") && lines[l].endsWith("]")) {
workflow += lines.slice(l).join("\n") + "\n\n";
// include comments before section header
let c = l - 1
let comment = ''
while (c >= 0 && lines[c].startsWith('#')) {
comment = lines[c] + '\n' + comment;
c -= 1;
}
workflow += comment + lines.slice(l).join("\n") + "\n\n";
break;
}
}
Expand Down

0 comments on commit 528b83a

Please sign in to comment.