From 4c58547f971776f63db9f8735c67ca4178596449 Mon Sep 17 00:00:00 2001 From: Igor Raits Date: Sat, 22 Feb 2020 19:03:02 +0100 Subject: [PATCH 2/2] chore: Update pulldown-cmark to 0.7 Signed-off-by: Igor Raits --- lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib.rs b/lib.rs index bcf59bd..f8d1295 100644 --- a/lib.rs +++ b/lib.rs @@ -11,7 +11,7 @@ use std::io::{self, Read, Write, Error as IoError}; use std::mem; use std::path::{PathBuf, Path}; use std::collections::HashMap; -use cmark::{Parser, Event, Tag}; +use cmark::{Parser, Event, Tag, CodeBlockKind}; /// Returns a list of markdown files under a directory. /// @@ -194,7 +194,7 @@ fn extract_tests_from_file(path: &Path) -> Result { fn extract_tests_from_string(s: &str, file_stem: &str) -> (Vec, Option) { let mut tests = Vec::new(); let mut buffer = Buffer::None; - let mut parser = Parser::new(s); + let parser = Parser::new(s); let mut section = None; let mut code_block_start = 0; // Oh this isn't actually a test but a legacy template @@ -212,7 +212,7 @@ fn extract_tests_from_string(s: &str, file_stem: &str) -> (Vec, Option { + Event::Start(Tag::CodeBlock(CodeBlockKind::Fenced(ref info))) => { let code_block_info = parse_code_block_info(info); if code_block_info.is_rust { buffer = Buffer::Code(Vec::new()); @@ -228,7 +228,7 @@ fn extract_tests_from_string(s: &str, file_stem: &str) -> (Vec, Option { + Event::End(Tag::CodeBlock(CodeBlockKind::Fenced(ref info))) => { let code_block_info = parse_code_block_info(info); if let Buffer::Code(buf) = mem::replace(&mut buffer, Buffer::None) { if code_block_info.is_old_template { @@ -277,7 +277,7 @@ fn load_templates(path: &Path) -> Result, IoError> { for event in parser { match event { - Event::Start(Tag::CodeBlock(ref info)) => { + Event::Start(Tag::CodeBlock(CodeBlockKind::Fenced(ref info))) => { let code_block_info = parse_code_block_info(info); if code_block_info.is_rust { code_buffer = Some(Vec::new()); @@ -288,7 +288,7 @@ fn load_templates(path: &Path) -> Result, IoError> { buf.push(text.to_string()); } } - Event::End(Tag::CodeBlock(ref info)) => { + Event::End(Tag::CodeBlock(CodeBlockKind::Fenced(ref info))) => { let code_block_info = parse_code_block_info(info); if let Some(buf) = code_buffer.take() { if let Some(t) = code_block_info.template { -- 2.25.0