more complete tokenization of urls with internal parentheses

This commit is contained in:
byte[] 2020-01-11 13:57:58 -05:00
parent 3ac8687c18
commit 6294c94704

View file

@ -91,10 +91,19 @@ defmodule Textile.Lexer do
image_url_scheme image_url_scheme
]) ])
defparsec(
:unbracketed_url_inside,
choice([
string("(") |> parsec(:unbracketed_url_inside) |> string(")"),
lookahead_not(end_of_link) |> utf8_char([])
])
|> repeat()
)
unbracketed_url = unbracketed_url =
string(":") string(":")
|> concat(link_url_scheme) |> concat(link_url_scheme)
|> repeat(lookahead_not(end_of_link) |> utf8_char([])) |> parsec(:unbracketed_url_inside)
unbracketed_image_url = unbracketed_image_url =
unbracketed_url unbracketed_url