cmark

My personal build of CMark ✏️

Commit
4a4b050a54382f15b9e62c2deb1111bd9d20b663
Parent
9a9a15312c443e4a4744023c196d57fbe40f8a05
Author
John MacFarlane <jgm@berkeley.edu>
Date

Changed parseEmphasis to just put things on stack.

Diffstat

1 file changed, 21 insertions, 18 deletions

Status File Name N° Changes Insertions Deletions
Modified js/lib/inlines.js 39 21 18
diff --git a/js/lib/inlines.js b/js/lib/inlines.js
@@ -261,17 +261,35 @@ var Str = function(s) {
 
 // Attempt to parse emphasis or strong emphasis.
 var parseEmphasis = function(cc,inlines) {
-    var startpos = this.pos;
 
     var res = this.scanDelims(cc);
     var numdelims = res.numdelims;
-    var usedelims;
+    var startpos = this.pos;
 
     if (numdelims === 0) {
         this.pos = startpos;
         return false;
     }
 
+    this.pos += numdelims;
+    inlines.push(Str(this.subject.slice(startpos, this.pos)));
+
+    // Add entry to stack for this opener
+    this.emphasis_openers = { cc: cc,
+                              numdelims: numdelims,
+                              pos: inlines.length - 1,
+                              previous: this.emphasis_openers,
+                              next: null,
+                              can_open: res.can_open,
+                              can_close: res.can_close};
+
+    return true;
+
+};
+
+/* TODO
+    var numdelims = res.numdelims;
+    var usedelims;
     if (res.can_close) {
 
       // Walk the stack and find a matching opener, if possible
@@ -318,22 +336,7 @@ var parseEmphasis = function(cc,inlines) {
     }
 
     // If we're here, we didn't match a closer.
-
-    this.pos += numdelims;
-    inlines.push(Str(this.subject.slice(startpos, startpos + numdelims)));
-
-    if (res.can_open) {
-
-      // Add entry to stack for this opener
-      this.emphasis_openers = { cc: cc,
-                                numdelims: numdelims,
-                                pos: inlines.length - 1,
-                                previous: this.emphasis_openers };
-    }
-
-    return true;
-
-};
+*/
 
 // Attempt to parse link title (sans quotes), returning the string
 // or null if no match.