|
|
@ -11,17 +11,17 @@ function parseLinkLabel(state, start) { |
|
|
|
labelEnd = -1, |
|
|
|
max = state.posMax, |
|
|
|
oldPos = state.pos, |
|
|
|
oldFlag = state.validateInsideLink; |
|
|
|
oldFlag = state.isInLabel; |
|
|
|
|
|
|
|
if (state.validateInsideLink) { return -1; } |
|
|
|
if (state.isInLabel) { return -1; } |
|
|
|
|
|
|
|
if (state.label_nest_level) { |
|
|
|
state.label_nest_level--; |
|
|
|
if (state.labelUnmatchedScopes) { |
|
|
|
state.labelUnmatchedScopes--; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
|
|
|
|
state.pos = start + 1; |
|
|
|
state.validateInsideLink = true; |
|
|
|
state.isInLabel = true; |
|
|
|
level = 1; |
|
|
|
|
|
|
|
while (state.pos < max) { |
|
|
@ -43,14 +43,14 @@ function parseLinkLabel(state, start) { |
|
|
|
|
|
|
|
if (found) { |
|
|
|
labelEnd = state.pos; |
|
|
|
state.label_nest_level = 0; |
|
|
|
state.labelUnmatchedScopes = 0; |
|
|
|
} else { |
|
|
|
state.label_nest_level = level - 1; |
|
|
|
state.labelUnmatchedScopes = level - 1; |
|
|
|
} |
|
|
|
|
|
|
|
// restore old state
|
|
|
|
state.pos = oldPos; |
|
|
|
state.validateInsideLink = oldFlag; |
|
|
|
state.isInLabel = oldFlag; |
|
|
|
|
|
|
|
return labelEnd; |
|
|
|
} |
|
|
@ -72,7 +72,7 @@ function parseLinkDestination(state, pos) { |
|
|
|
if (code === 0x0A /* \n */) { return false; } |
|
|
|
if (code === 0x3E /* > */) { |
|
|
|
state.pos = pos + 1; |
|
|
|
state.link_content = href; |
|
|
|
state.linkContent = href; |
|
|
|
return true; |
|
|
|
} |
|
|
|
if (code === 0x5C /* \ */ && pos + 1 < max) { |
|
|
@ -123,7 +123,7 @@ function parseLinkDestination(state, pos) { |
|
|
|
if (!state.parser.validateLink(href)) { return false; } |
|
|
|
|
|
|
|
state.pos = pos; |
|
|
|
state.link_content = href; |
|
|
|
state.linkContent = href; |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
@ -149,7 +149,7 @@ function parseLinkTitle(state, pos) { |
|
|
|
code = state.src.charCodeAt(pos); |
|
|
|
if (code === marker) { |
|
|
|
state.pos = pos + 1; |
|
|
|
state.link_content = title; |
|
|
|
state.linkContent = title; |
|
|
|
return true; |
|
|
|
} |
|
|
|
if (code === 0x5C /* \ */ && pos + 1 < max) { |
|
|
|