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