fixed parsing of title-less links
This commit is contained in:
parent
74edbf603e
commit
01d88135dc
|
@ -79,11 +79,12 @@ module PointBlank
|
||||||
[process_destination(result[0].gsub(/\\(?=[><])/, '')[1..-2]),
|
[process_destination(result[0].gsub(/\\(?=[><])/, '')[1..-2]),
|
||||||
text.delete_prefix(result[0]).lstrip]
|
text.delete_prefix(result[0]).lstrip]
|
||||||
elsif (result = text.match(/\A\S+/)) &&
|
elsif (result = text.match(/\A\S+/)) &&
|
||||||
!result[0].start_with?('<') &&
|
(lnk = result[0]) &&
|
||||||
result &&
|
!lnk.start_with?('<') &&
|
||||||
balanced?(result[0])
|
(lnk = (ix = find_balanced_end(lnk)) ? lnk[..ix - 1] : lnk) &&
|
||||||
[process_destination(result[0]),
|
balanced?(lnk)
|
||||||
text.delete_prefix(result[0]).lstrip]
|
[process_destination(lnk),
|
||||||
|
text.delete_prefix(lnk).lstrip]
|
||||||
else
|
else
|
||||||
[nil, text]
|
[nil, text]
|
||||||
end
|
end
|
||||||
|
@ -125,7 +126,7 @@ module PointBlank
|
||||||
destination, remaining = read_destination(remaining[1..])
|
destination, remaining = read_destination(remaining[1..])
|
||||||
return [nil, text] unless destination
|
return [nil, text] unless destination
|
||||||
|
|
||||||
title, remaining = read_title(remaining)
|
title, remaining = read_title(remaining.lstrip)
|
||||||
properties[:uri] = destination
|
properties[:uri] = destination
|
||||||
properties[:title] = title
|
properties[:title] = title
|
||||||
close_bracket = true
|
close_bracket = true
|
||||||
|
@ -164,7 +165,7 @@ module PointBlank
|
||||||
bracketcount += 1
|
bracketcount += 1
|
||||||
elsif part == ')'
|
elsif part == ')'
|
||||||
bracketcount -= 1
|
bracketcount -= 1
|
||||||
return index if bracketcount.zero?
|
return index if bracketcount <= 0
|
||||||
end
|
end
|
||||||
index += part.length
|
index += part.length
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue