Mercurial > md2html
comparison src/blockquote/mod.rs @ 0:9875208e49a0 tip
First entry
| author | ferencd |
|---|---|
| date | Thu, 16 Feb 2023 15:22:52 +0100 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:9875208e49a0 |
|---|---|
| 1 | |
| 2 // blockquote handling | |
| 3 pub fn deal_with_blockquote(html_lines: &mut Vec<String>, blockquote: &mut i8, ip: &mut String){ | |
| 4 let mut current_blockq: i8 = 0; | |
| 5 while ip.chars().nth(0).unwrap() == '>' { | |
| 6 *ip = ip[1..].to_string(); | |
| 7 current_blockq = current_blockq + 1; | |
| 8 } | |
| 9 if current_blockq != *blockquote { | |
| 10 let saved_bq = current_blockq; | |
| 11 if current_blockq < *blockquote { // the code has less blockquote, close a few ones | |
| 12 while current_blockq != *blockquote { | |
| 13 html_lines.push("</blockquote>".to_string()); | |
| 14 current_blockq = current_blockq + 1; | |
| 15 } | |
| 16 } | |
| 17 else { | |
| 18 while current_blockq != *blockquote { | |
| 19 html_lines.push("<blockquote>".to_string()); | |
| 20 current_blockq = current_blockq - 1; | |
| 21 } | |
| 22 } | |
| 23 *blockquote = saved_bq; | |
| 24 } | |
| 25 } |
