[−][src]Function parse_hyperlinks::parser::asciidoc::adoc_text2dest
pub fn adoc_text2dest(
i: &str
) -> IResult<&str, (Cow<'_, str>, Cow<'_, str>, Cow<'_, str>)>
Parses an Asciidoc inline link.
This parser expects to start at the first letter of http://,
https://, link:http:// or link:https:// (preceded by optional
whitespaces) to succeed.
When it starts at the letter h or l, the caller must guarantee, that:
- the parser is at the beginning of the input or
- the preceding byte is a newline
\n.
When ist starts at a whitespace no further guarantee is required.
link_title is always the empty Cow::Borrowed("").
use parse_hyperlinks::parser::Link; use parse_hyperlinks::parser::asciidoc::adoc_text2dest; use std::borrow::Cow; assert_eq!( adoc_text2dest(r#"https://destination[name]abc"#), Ok(("abc", (Cow::from("name"), Cow::from("https://destination"), Cow::from("")))) );