Browse Source

Remove state.linkLevel

It's redundant after the changes in links algorithm.
pull/24/head
Alex Kocharin 10 years ago
parent
commit
ea62dda30b
  1. 2
      lib/rules_inline/footnote_inline.js
  2. 5
      lib/rules_inline/links.js
  3. 3
      lib/rules_inline/state_inline.js

2
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;

5
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 });
}
}

3
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

Loading…
Cancel
Save