|
@ -50,9 +50,37 @@ function process_inlines(tokens, state) { |
|
|
pos = t.index + 1; |
|
|
pos = t.index + 1; |
|
|
isSingle = (t[0] === "'"); |
|
|
isSingle = (t[0] === "'"); |
|
|
|
|
|
|
|
|
// treat begin/end of the line as a whitespace
|
|
|
// Find previous character,
|
|
|
lastChar = t.index - 1 >= 0 ? text.charCodeAt(t.index - 1) : 0x20; |
|
|
// default to space if it's the beginning of the line
|
|
|
nextChar = pos < max ? text.charCodeAt(pos) : 0x20; |
|
|
//
|
|
|
|
|
|
lastChar = 0x20; |
|
|
|
|
|
|
|
|
|
|
|
if (t.index - 1 >= 0) { |
|
|
|
|
|
lastChar = text.charCodeAt(t.index - 1); |
|
|
|
|
|
} else { |
|
|
|
|
|
for (j = i - 1; j >= 0; j--) { |
|
|
|
|
|
if (tokens[j].type !== 'text') { continue; } |
|
|
|
|
|
|
|
|
|
|
|
lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Find next character,
|
|
|
|
|
|
// default to space if it's the end of the line
|
|
|
|
|
|
//
|
|
|
|
|
|
nextChar = 0x20; |
|
|
|
|
|
|
|
|
|
|
|
if (pos < max) { |
|
|
|
|
|
nextChar = text.charCodeAt(pos); |
|
|
|
|
|
} else { |
|
|
|
|
|
for (j = i + 1; j < tokens.length; j++) { |
|
|
|
|
|
if (tokens[j].type !== 'text') { continue; } |
|
|
|
|
|
|
|
|
|
|
|
nextChar = tokens[j].content.charCodeAt(0); |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar)); |
|
|
isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar)); |
|
|
isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar)); |
|
|
isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar)); |
|
|