pub fn generate_html(&self) -> String {
        let mut new_html: String = String::from("");

        match self.chunk_type {
			// matched open tag, ie <a href="">
            ChunkType::OpenTag => {
                new_html = new_html + "<" + &self.tag;

                if self.params_count > 0 {
                    new_html = new_html + " " + &self.generate_params_html();
                }

                new_html += ">";
            },
            // matched close tag, ie </a>
            ChunkType::CloseTag => {
                if self.params_count > 0 || self.end_closure {
                    new_html = new_html + "<" + &self.tag;

                    if self.params_count > 0 {
                        new_html = new_html + " " + &self.generate_params_html();
                    }

                    new_html += "/>";
                } else {
                    new_html = new_html + "</" + &self.tag + ">";
                }
            },
            ChunkType::Script => {
                if self.html.len() == 0 {
                    new_html = String::from("<script>n/a</script>");
                } else {
                    new_html = self.html.clone();
                }
            },
            ChunkType::Comment => {
                // note: we might have CDATA here that we treat as comments
                if self.tag == "!--" {
                    if self.html.len() == 0 {
                        new_html = String::from("<!-- n/a -->");
                    } else {
                        new_html = String::from("<!--") + &self.html + "-->";
                    }
                } else {
                    // ref: http://www.w3schools.com/xml/xml_cdata.asp
                    if self.tag == "![CDATA[" {
                        if self.html.len() == 0 {
                            new_html = String::from("<![CDATA[ n/a \n]]>");
                        } else {
                            new_html = String::from("<![CDATA[") + &self.html + "]]>";
                        }
                    }
                }
            },
            // matched normal text
            ChunkType::Text => {
                new_html = self.html.clone();
            }
        }

        new_html
    }
/// Generates HTML based on current chunk's data 
/// Note: this is not a high performance method and if you want ORIGINAL HTML that was parsed to create
/// this chunk then use relevant HtmlParser method to obtain such HTML then you should use
/// function of parser: set_raw_html
Generates HTML based on current chunk's data
Note: this is not a high performance method and if you want ORIGINAL HTML that was parsed to create
this chunk then use relevant HtmlParser method to obtain such HTML then you should use
function of parser: set_raw_html
Generates HTML based on current chunk ' s data Note : this is not a high performance method and if you want ORIGINAL HTML that was parsed to create this chunk then use relevant HtmlParser method to obtain such HTML then you should use function of parser : set_raw_html
pub fn generate_html(&self) -> String {
        let mut new_html: String = String::from("");
        match self.chunk_type {
			// matched open tag, ie <a href="">
            ChunkType::OpenTag => {
                new_html = new_html + "<" + &self.tag;
                if self.params_count > 0 {
                    new_html = new_html + " " + &self.generate_params_html();
                }
                new_html += ">";
            },
            // matched close tag, ie </a>
            ChunkType::CloseTag => {
                if self.params_count > 0 || self.end_closure {
                    new_html = new_html + "<" + &self.tag;
                    if self.params_count > 0 {
                        new_html = new_html + " " + &self.generate_params_html();
                    }
                    new_html += "/>";
                } else {
                    new_html = new_html + "</" + &self.tag + ">";
                }
            },
            ChunkType::Script => {
                if self.html.len() == 0 {
                    new_html = String::from("<script>n/a</script>");
                } else {
                    new_html = self.html.clone();
                }
            },
            ChunkType::Comment => {
                // note: we might have CDATA here that we treat as comments
                if self.tag == "!--" {
                    if self.html.len() == 0 {
                        new_html = String::from("<!-- n/a -->");
                    } else {
                        new_html = String::from("<!--") + &self.html + "-->";
                    }
                } else {
                    // ref: http://www.w3schools.com/xml/xml_cdata.asp
                    if self.tag == "![CDATA[" {
                        if self.html.len() == 0 {
                            new_html = String::from("<![CDATA[ n/a \n]]>");
                        } else {
                            new_html = String::from("<![CDATA[") + &self.html + "]]>";
                        }
                    }
                }
            },
            // matched normal text
            ChunkType::Text => {
                new_html = self.html.clone();
            }
        }
        new_html
    }
pub fn generate_html ( & self ) -> String { let mut new_html : String = String :: from ( " " ) ; match self . chunk_type { // matched open tag, ie <a href=""> ChunkType :: OpenTag => { new_html = new_html + " " + & self . tag ; if self . params_count > 0 { new_html = new_html + " " + & self . generate_params_html ( ) ; } new_html += " " ; } , // matched close tag, ie </a> ChunkType :: CloseTag => { if self . params_count > 0 || self . end_closure { new_html = new_html + " " + & self . tag ; if self . params_count > 0 { new_html = new_html + " " + & self . generate_params_html ( ) ; } new_html += " " ; } else { new_html = new_html + " " + & self . tag + " " ; } } , ChunkType :: Script => { if self . html . len ( ) == 0 { new_html = String :: from ( " " ) ; } else { new_html = self . html . clone ( ) ; } } , ChunkType :: Comment => { // note: we might have CDATA here that we treat as comments if self . tag == " " { if self . html . len ( ) == 0 { new_html = String :: from ( " " ) ; } else { new_html = String :: from ( " " ) + & self . html + " " ; } } else { // ref: http://www.w3schools.com/xml/xml_cdata.asp if self . tag == " " { if self . html . len ( ) == 0 { new_html = String :: from ( " \n " ) ; } else { new_html = String :: from ( " " ) + & self . html + " " ; } } } } , // matched normal text ChunkType :: Text => { new_html = self . html . clone ( ) ; } } new_html }
Generates HTML based on current chunk's data
Note: this is not a high performance method and if you want ORIGINAL HTML that was parsed to create
this chunk then use relevant HtmlParser method to obtain such HTML then you should use
function of parser: set_raw_html
Generates HTML based on current chunk ' s data Note : this is not a high performance method and if you want ORIGINAL HTML that was parsed to create this chunk then use relevant HtmlParser method to obtain such HTML then you should use function of parser : set_raw_html
&self
&self