fn walk_html_links(&mut self, node: &Handle) {
        match node.data {
            NodeData::Text { ref contents } => {
                self.extract_plaintext(&contents.borrow());
            }
            NodeData::Comment { ref contents } => {
                self.extract_plaintext(contents);
            }
            NodeData::Element {
                ref name,
                ref attrs,
                ..
            } => {
                for attr in attrs.borrow().iter() {
                    if url::elem_attr_is_link(attr.name.local.as_ref(), name.local.as_ref()) {
                        self.urls.push(attr.value.clone());
                    } else {
                        self.extract_plaintext(&attr.value);
                    }
                }
            }
            _ => {}
        }

        // recursively traverse the document's nodes -- this doesn't need any extra
        // exit conditions, because the document is a tree
        for child in node.children.borrow().iter() {
            self.walk_html_links(child);
        }
    }
/// Recursively walk links in a HTML document, aggregating URL strings in `urls`.
Recursively walk links in a HTML document, aggregating URL strings in `urls`.
Recursively walk links in a HTML document aggregating URL strings in ` urls ` .
fn walk_html_links(&mut self, node: &Handle) {
        match node.data {
            NodeData::Text { ref contents } => {
                self.extract_plaintext(&contents.borrow());
            }
            NodeData::Comment { ref contents } => {
                self.extract_plaintext(contents);
            }
            NodeData::Element {
                ref name,
                ref attrs,
                ..
            } => {
                for attr in attrs.borrow().iter() {
                    if url::elem_attr_is_link(attr.name.local.as_ref(), name.local.as_ref()) {
                        self.urls.push(attr.value.clone());
                    } else {
                        self.extract_plaintext(&attr.value);
                    }
                }
            }
            _ => {}
        }
        // recursively traverse the document's nodes -- this doesn't need any extra
        // exit conditions, because the document is a tree
        for child in node.children.borrow().iter() {
            self.walk_html_links(child);
        }
    }
fn walk_html_links ( & mut self , node : & Handle ) { match node . data { NodeData :: Text { ref contents } => { self . extract_plaintext ( & contents . borrow ( ) ) ; } NodeData :: Comment { ref contents } => { self . extract_plaintext ( contents ) ; } NodeData :: Element { ref name , ref attrs , .. } => { for attr in attrs . borrow ( ) . iter ( ) { if url :: elem_attr_is_link ( attr . name . local . as_ref ( ) , name . local . as_ref ( ) ) { self . urls . push ( attr . value . clone ( ) ) ; } else { self . extract_plaintext ( & attr . value ) ; } } } _ => { } } // recursively traverse the document's nodes -- this doesn't need any extra // exit conditions, because the document is a tree for child in node . children . borrow ( ) . iter ( ) { self . walk_html_links ( child ) ; } }
Recursively walk links in a HTML document, aggregating URL strings in `urls`.
Recursively walk links in a HTML document aggregating URL strings in ` urls ` .
&mut self
node
&Handle