cmark

My personal build of CMark ✏️

Commit
25a2ec46c0958f06fb93a12e0ca26e8b61acaa2a
Parent
8f2f40679dc21e9d878aaed45fe9dc9d404073d0
Author
John MacFarlane <jgm@berkeley.edu>
Date

Removed vestigial ReferenceDef node type.

Diffstat

3 files changed, 5 insertions, 11 deletions

Status File Name N° Changes Insertions Deletions
Modified js/lib/blocks.js 8 5 3
Modified js/lib/html.js 4 0 4
Modified js/lib/xml.js 4 0 4
diff --git a/js/lib/blocks.js b/js/lib/blocks.js
@@ -220,8 +220,9 @@ var listsMatch = function(list_data, item_data) {
 var closeUnmatchedBlocks = function() {
     // finalize any blocks not matched
     while (this.oldtip !== this.lastMatchedContainer) {
+        var parent = this.oldtip.parent;
         this.finalize(this.oldtip, this.lineNumber - 1);
-        this.oldtip = this.oldtip.parent;
+        this.oldtip = parent;
     }
     return true;
 };
@@ -561,6 +562,7 @@ var incorporateLine = function(ln) {
 // parent of the closed block.
 var finalize = function(block, lineNumber) {
     var pos;
+    var above = block.parent || this.top;
     // don't do anything if the block is already closed
     if (!block.open) {
         return 0;
@@ -578,7 +580,7 @@ var finalize = function(block, lineNumber) {
                                                        this.refmap))) {
             block.string_content = block.string_content.slice(pos);
             if (isBlank(block.string_content)) {
-                block.setType('ReferenceDef');
+                block.unlink();
                 break;
             }
         }
@@ -635,7 +637,7 @@ var finalize = function(block, lineNumber) {
         break;
     }
 
-    this.tip = block.parent || this.top;
+    this.tip = above;
 };
 
 // Walk through a block & children recursively, parsing string content
diff --git a/js/lib/html.js b/js/lib/html.js
@@ -220,10 +220,6 @@ var renderNodes = function(block) {
             cr();
             break;
 
-
-        case 'ReferenceDef':
-            break;
-
         default:
             throw "Unknown node type " + node.getType();
         }
diff --git a/js/lib/xml.js b/js/lib/xml.js
@@ -74,10 +74,6 @@ var renderNodes = function(block) {
         node = event.node;
         nodetype = node.getType();
 
-        if (nodetype === 'ReferenceDef') {
-            continue;
-        }
-
         container = node.isContainer();
         selfClosing = nodetype === 'HorizontalRule' || nodetype === 'Hardbreak' ||
             nodetype === 'Softbreak' || nodetype === 'Image';