Browse Source

Fix: whitespace in links element can contain newlines

pull/14/head
Alex Kocharin 10 years ago
parent
commit
0894209d96
  1. 18
      lib/lexer_inline/links.js

18
lib/lexer_inline/links.js

@ -3,8 +3,6 @@
'use strict';
var skipSpaces = require('../helpers').skipSpaces;
//
// Parse link label
//
@ -202,7 +200,11 @@ function links(state) {
// [link]( <href> "title" )
// ^^ skipping these spaces
pos++;
if ((pos = skipSpaces(state, pos)) >= max) { return false; }
for (; pos < max; pos++) {
code = state.src.charCodeAt(pos);
if (code !== 0x20 && code !== 0x0A) { break; }
}
if (pos >= max) { return false; }
// [link]( <href> "title" )
// ^^^^^^ parsing link destination
@ -217,7 +219,10 @@ function links(state) {
// [link]( <href> "title" )
// ^^ skipping these spaces
start = pos;
pos = skipSpaces(state, pos);
for (; pos < max; pos++) {
code = state.src.charCodeAt(pos);
if (code !== 0x20 && code !== 0x0A) { break; }
}
// [link]( <href> "title" )
// ^^^^^^^ parsing link title
@ -226,7 +231,10 @@ function links(state) {
// [link]( <href> "title" )
// ^^ skipping these spaces
pos = skipSpaces(state, pos);
for (; pos < max; pos++) {
code = state.src.charCodeAt(pos);
if (code !== 0x20 && code !== 0x0A) { break; }
}
} else {
title = '';
}

Loading…
Cancel
Save