mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 12:37:58 +01:00
14 lines
No EOL
338 B
Elixir
14 lines
No EOL
338 B
Elixir
defmodule Textile.UrlLexer do
|
|
import NimbleParsec
|
|
|
|
def url_ending_in(ending_sequence) do
|
|
protocol =
|
|
choice([
|
|
string("/"), string("https://"), string("http://"), string("data:image/")
|
|
])
|
|
|
|
protocol
|
|
|> repeat(lookahead_not(ending_sequence) |> utf8_char([]))
|
|
|> reduce({List, :to_string, []})
|
|
end
|
|
end |