view src/blockquote/mod.rs @ 0:9875208e49a0 tip

First entry
author ferencd
date Thu, 16 Feb 2023 15:22:52 +0100
parents
children
line wrap: on
line source

// blockquote handling
pub fn deal_with_blockquote(html_lines: &mut Vec<String>, blockquote: &mut i8, ip: &mut String){
    let mut current_blockq: i8 = 0;
    while ip.chars().nth(0).unwrap() == '>' {
        *ip = ip[1..].to_string();
        current_blockq = current_blockq + 1;
    }
    if current_blockq != *blockquote {
        let saved_bq = current_blockq;
        if current_blockq < *blockquote { // the code has less blockquote, close a few ones
            while current_blockq != *blockquote {
                html_lines.push("</blockquote>".to_string());
                current_blockq = current_blockq + 1;
            }
        }
        else {
            while current_blockq != *blockquote {
                html_lines.push("<blockquote>".to_string());
                current_blockq = current_blockq - 1;
            }
        }
        *blockquote = saved_bq;
    }
}