Function take_text2dest

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

Consumes the input until the parser finds an HTML formatted hyperlink text2dest (Link::Text2Dest).

The parser consumes the finding and returns Ok((remaining_input, (skipped_input, (link_text, link_destination, link_title)))) or some error.

ยงHTML

use parse_hyperlinks::parser::Link;
use parse_hyperlinks_extras::parser::parse_html::take_text2dest;
use std::borrow::Cow;

let i = r#"abc<a href="dest1" title="title1">text1</a>abc
abc<a href="dest2" title="title2">text2</a>abc"#;

let (i, r) = take_text2dest(i).unwrap();
assert_eq!(r.0, "abc");
assert_eq!(r.1, (Cow::from("text1"), Cow::from("dest1"), Cow::from("title1")));
let (i, r) = take_text2dest(i).unwrap();
assert_eq!(r.0, "abc\nabc");
assert_eq!(r.1, (Cow::from("text2"), Cow::from("dest2"), Cow::from("title2")));