From ea62dda30bde7b4766605111ca1f21263e4d5ba7 Mon Sep 17 00:00:00 2001 From: Alex Kocharin Date: Sun, 28 Dec 2014 23:07:13 +0300 Subject: [PATCH] Remove state.linkLevel It's redundant after the changes in links algorithm. --- lib/rules_inline/footnote_inline.js | 2 -- lib/rules_inline/links.js | 5 ----- lib/rules_inline/state_inline.js | 3 --- 3 files changed, 10 deletions(-) diff --git a/lib/rules_inline/footnote_inline.js b/lib/rules_inline/footnote_inline.js index ee0fb23..b8e9c4a 100644 --- a/lib/rules_inline/footnote_inline.js +++ b/lib/rules_inline/footnote_inline.js @@ -40,11 +40,9 @@ module.exports = function footnote_inline(state, silent) { id: footnoteId, level: state.level }); - state.linkLevel++; oldLength = state.tokens.length; state.parser.tokenize(state); state.env.footnotes.list[footnoteId] = { tokens: state.tokens.splice(oldLength) }; - state.linkLevel--; } state.pos = labelEnd + 1; diff --git a/lib/rules_inline/links.js b/lib/rules_inline/links.js index f9fa452..df7c95a 100644 --- a/lib/rules_inline/links.js +++ b/lib/rules_inline/links.js @@ -99,9 +99,6 @@ module.exports = function links(state, silent) { // if (typeof state.env.references === 'undefined') { return false; } - // do not allow nested reference links - if (state.linkLevel > 0) { return false; } - // [foo] [bar] // ^^ optional whitespace (can include newlines) for (; pos < max; pos++) { @@ -166,9 +163,7 @@ module.exports = function links(state, silent) { title: title, level: state.level++ }); - state.linkLevel++; state.parser.tokenize(state); - state.linkLevel--; state.push({ type: 'link_close', level: --state.level }); } } diff --git a/lib/rules_inline/state_inline.js b/lib/rules_inline/state_inline.js index 8b91345..954c562 100644 --- a/lib/rules_inline/state_inline.js +++ b/lib/rules_inline/state_inline.js @@ -20,9 +20,6 @@ function StateInline(src, parserInline, options, env, outTokens) { // Link parser state vars - this.linkLevel = 0; // Increment for each nesting link. Used to prevent - // nesting in definitions - this.linkContent = ''; // Temporary storage for link url this.labelUnmatchedScopes = 0; // Track unpaired `[` for link labels