Function ahref::get_a_tags

source ·
pub fn get_a_tags(html: String) -> Vec<String>
Expand description

Extract html ‘a’ tag from page

Examples

    use ahref::get_a_tags;

    let html = "<p>Test</p><a>without link</a><a href='https://github.com/tenqz/'>Test Link 1</a><p>Another Text</p><a href='https://github.com/tenqz/'>Test Link 2</a><p>Another Text</p><a class='test' href='https://github.com/tenqz/'>Test Link 3</a><p>Another Text</p>".to_string();
    let tags = get_a_tags(html);
    assert_eq!(
       vec![
           "<a>without link</a>".to_string(),
           "<a href='https://github.com/tenqz/'>Test Link 1</a>".to_string(),
           "<a href='https://github.com/tenqz/'>Test Link 2</a>".to_string(),
           "<a class='test' href='https://github.com/tenqz/'>Test Link 3</a>".to_string()
       ],
       tags
   );