workaround for bug in title text regex

This commit is contained in:
Rudis Muiznieks 2014-07-04 01:18:24 -05:00
parent 673e4690dc
commit edd255f77f
1 changed files with 8 additions and 1 deletions

View File

@ -21,6 +21,9 @@ matchAnchor = (text) ->
text: match[2] text: match[2]
href: match[3] href: match[3]
title: match[6] title: match[6]
if result.href.indexOf('"') == 0
result.title = result.href.substring 1, result.href.length - 1
result.href = ''
return result return result
return match return match
@ -28,11 +31,15 @@ matchAnchors = (text) ->
re = new RegExp regexLib.anchors re = new RegExp regexLib.anchors
anchors = [] anchors = []
while match = re.exec text while match = re.exec text
anchors.push anchor =
anchor: match[1] anchor: match[1]
text: match[2] text: match[2]
href: match[3] href: match[3]
title: match[6] title: match[6]
if anchor.href.indexOf('"') == 0
anchor.title = anchor.href.substring 1, anchor.href.length - 1
anchor.href = ''
anchors.push anchor
return anchors return anchors
trimText = (text) -> trimText = (text) ->