diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-01-09 13:26:58 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-01-09 13:26:58 -0800 |
commit | 0d9c230a46f1bf79d4be81cb42cfaebc6f5b5ced (patch) | |
tree | 378e311e44ad77078eb2ebc8ef5c303e7d17662e | |
parent | eb6a4c5c5387dde76b9c9cef8260b5b70835e2cf (diff) |
Made `tight` a property of `list_data`.
-rw-r--r-- | js/lib/blocks.js | 13 | ||||
-rw-r--r-- | js/lib/html.js | 2 | ||||
-rw-r--r-- | js/lib/node.js | 3 |
3 files changed, 11 insertions, 7 deletions
diff --git a/js/lib/blocks.js b/js/lib/blocks.js index aa09b23..29c8412 100644 --- a/js/lib/blocks.js +++ b/js/lib/blocks.js @@ -149,7 +149,12 @@ var parseListMarker = function(ln, offset) { var rest = ln.slice(offset); var match; var spaces_after_marker; - var data = {}; + var data = { type: undefined, + tight: true, + bullet_char: undefined, + start: undefined, + delimiter: undefined, + padding: undefined }; if (rest.match(reHrule)) { return null; } @@ -585,13 +590,13 @@ var finalize = function(block, line_number) { break; case 'List': - block.tight = true; // tight by default + block.list_data.tight = true; // tight by default var item = block.firstChild; while (item) { // check for non-final list item ending with blank line: if (endsWithBlankLine(item) && item.next) { - block.tight = false; + block.list_data.tight = false; break; } // recurse into children of list item, to see if there are @@ -599,7 +604,7 @@ var finalize = function(block, line_number) { var subitem = item.firstChild; while (subitem) { if (endsWithBlankLine(subitem) && (item.next || subitem.next)) { - block.tight = false; + block.list_data.tight = false; break; } subitem = subitem.next; diff --git a/js/lib/html.js b/js/lib/html.js index 045ab54..3c1ed4c 100644 --- a/js/lib/html.js +++ b/js/lib/html.js @@ -118,7 +118,7 @@ var renderNodes = function(block) { grandparent = node.parent.parent; if (grandparent !== null && grandparent.t === 'List') { - if (grandparent.tight) { + if (grandparent.list_data.tight) { break; } } diff --git a/js/lib/node.js b/js/lib/node.js index 5f82eca..5e5d5b0 100644 --- a/js/lib/node.js +++ b/js/lib/node.js @@ -74,7 +74,6 @@ function Node(nodeType, pos) { this.string_content = ""; this.c = undefined; this.list_data = undefined; - this.tight = undefined; this.info = undefined; this.destination = undefined; this.title = undefined; @@ -169,7 +168,7 @@ Node.prototype.toAST = function() { var result = { t: this.t }; var propsToShow = ['t', 'c', 'list_data', 'string_content', - 'pos', 'tight', 'info', 'level']; + 'pos', 'info', 'level']; for (var i = 0; i < propsToShow.length; i++) { var prop = propsToShow[i]; |