diff options
-rw-r--r-- | src/content/document.rs | 15 | ||||
-rw-r--r-- | tests/block_quote.rs | 11 | ||||
-rw-r--r-- | tests/code_fenced.rs | 35 |
3 files changed, 36 insertions, 25 deletions
diff --git a/src/content/document.rs b/src/content/document.rs index 0c95eed..0112d52 100644 --- a/src/content/document.rs +++ b/src/content/document.rs @@ -295,11 +295,26 @@ fn exit_containers( if info.stack.len() > size { // To do: inject these somewhere? Fix positions? println!("closing flow. To do: are these resulting exits okay?"); + let index = tokenizer.events.len(); let result = tokenizer.flush(info.next); info.next = Box::new(flow); // This is weird but Rust needs a function there. assert!(matches!(result.0, State::Ok)); assert!(result.1.is_none()); + let mut end = tokenizer.events.len(); + while end > 0 && end > index { + if tokenizer.events[end - 1].token_type != Token::LineEnding { + break; + } + + end -= 1; + } + + let mut add = tokenizer.events.drain(index..end).collect::<Vec<_>>(); + + println!("evs: {:#?}", add); + exits.append(&mut add); + println!(" setting `interrupt: false`"); tokenizer.interrupt = false; } diff --git a/tests/block_quote.rs b/tests/block_quote.rs index 5967f78..5e5adce 100644 --- a/tests/block_quote.rs +++ b/tests/block_quote.rs @@ -74,12 +74,11 @@ fn block_quote() { // "should not support lazy indented code in block quotes" // ); - // To do: block quote (lazy, code (fenced)). - // assert_eq!( - // micromark("> ```\na\n```"), - // "<blockquote>\n<pre><code></code></pre>\n</blockquote>\n<p>a</p>\n<pre><code></code></pre>\n", - // "should not support lazy fenced code in block quotes" - // ); + assert_eq!( + micromark("> ```\na\n```"), + "<blockquote>\n<pre><code></code></pre>\n</blockquote>\n<p>a</p>\n<pre><code></code></pre>\n", + "should not support lazy fenced code in block quotes" + ); // To do: list. // assert_eq!( diff --git a/tests/code_fenced.rs b/tests/code_fenced.rs index 780a78f..a777f9f 100644 --- a/tests/code_fenced.rs +++ b/tests/code_fenced.rs @@ -57,12 +57,11 @@ fn code_fenced() { "should support an eof somewhere in content" ); - // To do: blockquote (fix exits, fix compiler). - // assert_eq!( - // micromark("> ```\n> aaa\n\nbbb"), - // "<blockquote>\n<pre><code>aaa\n</code></pre>\n</blockquote>\n<p>bbb</p>", - // "should support no closing sequence in a block quote" - // ); + assert_eq!( + micromark("> ```\n> aaa\n\nbbb"), + "<blockquote>\n<pre><code>aaa\n</code></pre>\n</blockquote>\n<p>bbb</p>", + "should support no closing sequence in a block quote" + ); assert_eq!( micromark("```\n\n \n```"), @@ -227,19 +226,18 @@ fn code_fenced() { "should not support a closing sequence w/ too much indent, regardless of opening sequence (1)" ); - // To do: blockquote (fix exits, fix compiler). + // To do: blockquote (fix compiler). // assert_eq!( // micromark("> ```\n>\n>\n>\n\na"), // "<blockquote>\n<pre><code>\n\n\n</code></pre>\n</blockquote>\n<p>a</p>", // "should not support a closing sequence w/ too much indent, regardless of opening sequence (2)" // ); - // To do: blockquote (fix exits, fix compiler). - // assert_eq!( - // micromark("> ```a\nb"), - // "<blockquote>\n<pre><code class=\"language-a\"></code></pre>\n</blockquote>\n<p>b</p>", - // "should not support lazyness (1)" - // ); + assert_eq!( + micromark("> ```a\nb"), + "<blockquote>\n<pre><code class=\"language-a\"></code></pre>\n</blockquote>\n<p>b</p>", + "should not support lazyness (1)" + ); assert_eq!( micromark("> a\n```b"), @@ -247,12 +245,11 @@ fn code_fenced() { "should not support lazyness (2)" ); - // To do: blockquote (fix exits, fix compiler). - // assert_eq!( - // micromark("> ```a\n```"), - // "<blockquote>\n<pre><code class=\"language-a\"></code></pre>\n</blockquote>\n<pre><code></code></pre>\n", - // "should not support lazyness (3)" - // ); + assert_eq!( + micromark("> ```a\n```"), + "<blockquote>\n<pre><code class=\"language-a\"></code></pre>\n</blockquote>\n<pre><code></code></pre>\n", + "should not support lazyness (3)" + ); // To do: turning things off. // assert_eq!( |