Skip to content

Commit 2422a75

Browse files
committed
note scripts: can have an empty line in a note if the next line starts with a space
An annoying problem when writing marking or diagnostic algorithms was that you couldn't put an empty line in something like a big `let` call: note_1: let( a, 1, b, 2, a+b ) note_2: note_1 This commit changes the regex so that the next thing after the two line breaks must be a non-space character, i.e. the next line after the gap must not be indented. This allows gaps inside expressions like the one above, where the next line after the gap is indented.
1 parent 2dd1a1d commit 2422a75

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

runtime/scripts/jme-variables.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ jme.variables.note_script_constructor = function(construct_scope, process_result
680680
this.source = source;
681681
scope = construct_scope(scope || Numbas.jme.builtinScope);
682682
try {
683-
var notes = source.split(/\n(\s*\n)+/);
683+
var notes = source.replace(/^\/\/.*$/gm,'').split(/\n(?:\s*\n)+(?!\s)/);
684684
var ntodo = {};
685685
var todo = {};
686686
notes.forEach(function(note) {

0 commit comments

Comments
 (0)