Function parse_hyperlinks::parser::html::html_text2dest
source · pub fn html_text2dest(
i: &str
) -> IResult<&str, (Cow<'_, str>, Cow<'_, str>, Cow<'_, str>)>
Expand description
Parse an HTML inline hyperlink.
It returns either Ok((i, (link_text, link_destination, link_title)))
or some error.
The parser expects to start at the link start (<
) to succeed.
use parse_hyperlinks::parser::Link;
use parse_hyperlinks::parser::html::html_text2dest;
use std::borrow::Cow;
assert_eq!(
html_text2dest(r#"<a href="destination" title="title">name</a>abc"#),
Ok(("abc", (Cow::from("name"), Cow::from("destination"), Cow::from("title"))))
);