From 6db093844ba9cbc1ee09f9786f864581e4963064 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Fri, 17 Oct 2014 04:27:01 +0400 Subject: [PATCH] Avoid shadow copy for inline containers --- lib/rules_block/heading.js | 3 ++- lib/rules_block/lheading.js | 3 ++- lib/rules_block/paragraph.js | 3 ++- lib/rules_block/table.js | 7 +++++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/rules_block/heading.js b/lib/rules_block/heading.js index 2123530..630ad2a 100644 --- a/lib/rules_block/heading.js +++ b/lib/rules_block/heading.js @@ -51,7 +51,8 @@ module.exports = function heading(state, startLine, endLine, silent) { state.tokens.push({ type: 'inline', content: state.src.slice(pos, max).trim(), - level: state.level + 1 + level: state.level + 1, + children: [] }); } state.tokens.push({ type: 'heading_close', hLevel: level, level: state.level }); diff --git a/lib/rules_block/lheading.js b/lib/rules_block/lheading.js index fa329c3..9dc081d 100644 --- a/lib/rules_block/lheading.js +++ b/lib/rules_block/lheading.js @@ -42,7 +42,8 @@ module.exports = function lheading(state, startLine, endLine, silent) { state.tokens.push({ type: 'inline', content: state.src.slice(pos, state.eMarks[startLine]).trim(), - level: state.level + 1 + level: state.level + 1, + children: [] }); state.tokens.push({ type: 'heading_close', diff --git a/lib/rules_block/paragraph.js b/lib/rules_block/paragraph.js index 5e5e4d5..05c9a2b 100644 --- a/lib/rules_block/paragraph.js +++ b/lib/rules_block/paragraph.js @@ -43,7 +43,8 @@ module.exports = function paragraph(state, startLine/*, endLine*/) { state.tokens.push({ type: 'inline', content: content, - level: state.level + 1 + level: state.level + 1, + children: [] }); state.tokens.push({ type: 'paragraph_close', level: state.level }); } diff --git a/lib/rules_block/table.js b/lib/rules_block/table.js index 4a9c675..5a018f4 100644 --- a/lib/rules_block/table.js +++ b/lib/rules_block/table.js @@ -64,7 +64,8 @@ module.exports = function table(state, startLine, endLine, silent) { state.tokens.push({ type: 'inline', content: rows[i].trim(), - level: state.level + level: state.level, + children: [] }); state.tokens.push({ type: 'th_close', level: --state.level }); } @@ -85,7 +86,9 @@ module.exports = function table(state, startLine, endLine, silent) { state.tokens.push({ type: 'td_open', align: aligns[i], level: state.level++ }); state.tokens.push({ type: 'inline', - content: rows[i].replace(/^\|? *| *\|?$/g, '') + content: rows[i].replace(/^\|? *| *\|?$/g, ''), + level: state.level, + children: [] }); state.tokens.push({ type: 'td_close', level: --state.level }); }