diff options
| -rw-r--r-- | src/lib.rs | 2 | ||||
| -rw-r--r-- | tests/test_style_parser.py | 4 |
2 files changed, 5 insertions, 1 deletions
@@ -295,7 +295,7 @@ fn seek_end_block(chars: &Vec<char>, keyword: char, start: usize, end: usize, de if i + 1 + depth > end { return Some(i); } - if i + 4 + depth > end + if seek_end_of_line(chars, i + 1, end) == i + depth + 4 && chars[i + 1..i + 1 + depth].iter().all(|&c| QUOTE_KEYWORDS.contains(&c)) && chars[i + 1 + depth] == keyword && is_char_repeating(chars, keyword, 2, i + 1 + depth, end) diff --git a/tests/test_style_parser.py b/tests/test_style_parser.py index 86a7eff..8f39580 100644 --- a/tests/test_style_parser.py +++ b/tests/test_style_parser.py @@ -90,6 +90,10 @@ def test_code_blocks(): formatted_body = "<pre><code class=\"language-python\">hacker code</code></pre>" assert(format_body(test, MATRIX_FORMATS) == formatted_body) + test = "```python\nhacker code\n```\nnormal text" + formatted_body = "<pre><code class=\"language-python\">hacker code</code></pre><br>normal text" + assert(format_body(test, MATRIX_FORMATS) == formatted_body) + test = ">```java\n>why are you quoting a code block\n>```" formatted_body = "<blockquote><pre><code class=\"language-java\">why are you quoting a code block</code></pre></blockquote>" assert(format_body(test, MATRIX_FORMATS) == formatted_body) |
