summaryrefslogtreecommitdiff
path: root/js/lib/blocks.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/blocks.js')
-rw-r--r--js/lib/blocks.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/js/lib/blocks.js b/js/lib/blocks.js
index 617d60d..d8c25a1 100644
--- 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