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

Loading…
Cancel
Save