/// Helper function to parse url in a page.
/// Converts relative urls to full urls.
/// Also removes javascript urls and other false urls.
Helper function to parse url in a page.
Converts relative urls to full urls.
Also removes javascript urls and other false urls.
Helper function to parse url in a page . Converts relative urls to full urls . Also removes javascript urls and other false urls .
pub fn normalize_url(url: &str, base_url: &str) -> Option<Link> {
    if url.starts_with("#") {
        // Checks for internal links.
        // Maybe will make it optioanl to ignore them.
        return None;
    }
    match Link::new_from_str(&url) {
        Some(x) => Some(x),
        None => Link::new_relative(&url, base_url),
    }
}
pub fn normalize_url ( url : & str , base_url : & str ) -> Option < Link > { if url . starts_with ( " " ) { // Checks for internal links. // Maybe will make it optioanl to ignore them. return None ; } match Link :: new_from_str ( & url ) { Some ( x ) => Some ( x ) , None => Link :: new_relative ( & url , base_url ) , } }
Helper function to parse url in a page.
Helper function to parse url in a page .
url
&str
base_url
&str