html_img2dest

Function html_img2dest 

Source
pub fn html_img2dest(
    i: &str,
) -> IResult<&str, (Cow<'_, str>, Cow<'_, str>, Cow<'_, str>, Cow<'_, str>, Cow<'_, str>, Cow<'_, str>)>
Expand description

Parse an HTML inline hyperlink with embedded image.

It returns either

The parser expects to start at the link start (<) to succeed.

use parse_hyperlinks::parser::Link;
use parse_hyperlinks::parser::html_img::html_img2dest;
use std::borrow::Cow;

assert_eq!(
  html_img2dest("<a href=\"my doc.html\" title=\"title\">\
                   before<img src=\"dog.png\" alt=\"alt dog\"/>after\
                   </a>abc"),
  Ok(("abc",
   (Cow::from("before"), Cow::from("alt dog"), Cow::from("dog.png"),
    Cow::from("after"), Cow::from("my doc.html"), Cow::from("title"),
))));