Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
davisjam committed Apr 16, 2018
1 parent ba2fc13 commit 47f4388
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,44 +580,40 @@ inline.pedantic = merge({}, inline.normal, {
var parsingRegexes = [destinationAndTitleRe, destinationRe];

var match = false;
var dest = undefined;
var title = undefined;
for (var i = 0; i < parsingRegexes.length; i++) {
match = parsingRegexes[i].exec(destination);
if (match) {
dest = match[1];
title = match[2];
break;
}
}

if (match) {
// title is optional.
if (typeof title === 'undefined') {
title = '';
}
if (!match) {
return null;
}

// Format dest.
dest = dest.trim();
dest = unwrapAngleBrackets(dest);
var dest = match[1];
var title = match[2] || ''; // Not all parsingRegexes have 2 groups.

return [dest, title];
}
return null;
// Format dest.
dest = dest.trim();
dest = unwrapAngleBrackets(dest);

return [dest, title];
}

var fullMatch = generalLinkRe.exec(s);
if (fullMatch) {
var text = fullMatch[1];
var destination = fullMatch[2];

// Does 'destination' match spec?
var destinationAndTitle = splitIntoDestinationAndTitle(destination);
if (destinationAndTitle) {
return [fullMatch[0], text, destinationAndTitle[0], destinationAndTitle[1]];
}
if (!fullMatch) {
return null;
}

var text = fullMatch[1];
var destination = fullMatch[2];

var destinationAndTitle = splitIntoDestinationAndTitle(destination);
if (!destinationAndTitle) {
return null;
}
return null;
return [fullMatch[0], text, destinationAndTitle[0], destinationAndTitle[1]];
}
},
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
Expand Down

0 comments on commit 47f4388

Please sign in to comment.