diff options
| author | SavagePeanut <sourcehut@lazytapir.com> | 2023-09-03 21:27:07 -0500 |
|---|---|---|
| committer | SavagePeanut <sourcehut@lazytapir.com> | 2023-09-03 21:27:07 -0500 |
| commit | fbd5eeb993b4a934b6cb2598adbb67485e74f16b (patch) | |
| tree | c41c81dcda03ad343563680b8eb2e3266a093d33 /src | |
| parent | d8140d13e82f9b320e069b2e8b85cca93c8a7ac4 (diff) | |
add test case
Diffstat (limited to 'src')
| -rw-r--r-- | src/matrix.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/matrix.rs b/src/matrix.rs index 92d2eb8..963e569 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -46,7 +46,7 @@ pub fn format_for_matrix(body: String) -> PyResult<String> { if tag == "</code></pre>" { // index is at \n, add 1 to skip that one let substring = chars[index + 1..replace_newlines_to].into_iter().collect::<String>(); - chars = [&chars[..index + 1], &substring.replace('\n', "<br>").chars().collect::<Vec<char>>()[..]].concat(); + chars = [&chars[..index + 1], &substring.replace('\n', "<br>").chars().collect::<Vec<char>>()[..], &chars[replace_newlines_to..]].concat(); } else if tag == "<pre><code>" { replace_newlines_to = index; } @@ -60,6 +60,7 @@ pub fn format_for_matrix(body: String) -> PyResult<String> { } else { replace_newlines_to - offset.abs() as usize }; + println!("chars {:?}", chars.clone().into_iter().collect::<String>()); } let substring = chars[..replace_newlines_to].into_iter().collect::<String>(); let text = [substring.replace('\n', "<br>"), chars[replace_newlines_to..].into_iter().collect::<String>()].concat(); |
