Mercurial > md2html
diff 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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/blockquote/mod.rs Thu Feb 16 15:22:52 2023 +0100 @@ -0,0 +1,25 @@ + +// 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; + } +} \ No newline at end of file
