Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 81dd95f

Browse files
committed
improve parsing of tag & depends options
1 parent c119119 commit 81dd95f

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

runestone/parsons/js/parsons.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,17 +301,16 @@ export default class Parsons extends RunestoneBase {
301301
.substring(distractIndex + 12, textBlock.length)
302302
.trim();
303303
textBlock = textBlock.substring(0, distractIndex + 11);
304-
305-
// TODO make this parsing more robust after finalizing the syntax
306304
} else if (textBlock.includes("#tag:")) {
305+
textBlock = textBlock.replace(/#tag:.*;.*;/, s => s.replace(/\s+/g, "")); // remove whitespace in tag and depends list
307306
tagIndex = textBlock.indexOf("#tag:");
308307
tag = textBlock.substring(tagIndex + 5, tagIndex + 6);
309308
dependsIndex = textBlock.indexOf(";depends:");
310309
let dependsString = textBlock.substring(dependsIndex + 9, textBlock.indexOf(";", dependsIndex + 9));
311310
depends = dependsString.length > 0 ? dependsString.split(",") : [];
312311
}
313312
textBlock = textBlock.replace(
314-
/#(paired|distractor|tag:[0-9]+;depends:[0-9,]*;)/,
313+
/#(paired|distractor|tag:.*;.*;)/,
315314
function (mystring, arg1) {
316315
options[arg1] = true;
317316
return "";

0 commit comments

Comments
 (0)