rustfmt fix

Signed-off-by: Max Schrader <mcschrader@crimson.ua.edu>
This commit is contained in:
Max Schrader 2022-01-16 12:50:23 -06:00
parent 6103ce0087
commit 694eb1520b
3 changed files with 18 additions and 20 deletions

View File

@ -1,6 +1,6 @@
use eyre::{eyre, Result};
use gumdrop::Options;
use obsidian_export::postprocessors::{softbreaks_to_hardbreaks, create_frontmatter_filter};
use obsidian_export::postprocessors::{create_frontmatter_filter, softbreaks_to_hardbreaks};
use obsidian_export::{ExportError, Exporter, FrontmatterStrategy, WalkOptions};
use std::{env, path::PathBuf};

View File

@ -42,10 +42,8 @@ pub fn create_frontmatter_filter(
) -> impl Fn(&mut Context, &mut MarkdownEvents) -> PostprocessorResult {
let key = serde_yaml::Value::String(yaml_filter_key.to_string());
move |context: &mut Context, _events: &mut MarkdownEvents| {
match context.frontmatter.get(&key) {
Some(Value::Bool(true)) => PostprocessorResult::Continue,
_ => PostprocessorResult::StopAndSkipNote,
}
move |context: &mut Context, _events: &mut MarkdownEvents| match context.frontmatter.get(&key) {
Some(Value::Bool(true)) => PostprocessorResult::Continue,
_ => PostprocessorResult::StopAndSkipNote,
}
}

View File

@ -1,4 +1,4 @@
use obsidian_export::postprocessors::{softbreaks_to_hardbreaks, create_frontmatter_filter};
use obsidian_export::postprocessors::{create_frontmatter_filter, softbreaks_to_hardbreaks};
use obsidian_export::{Context, Exporter, MarkdownEvents, PostprocessorResult};
use pretty_assertions::assert_eq;
use pulldown_cmark::{CowStr, Event};
@ -239,11 +239,14 @@ fn test_yaml_inclusion() {
exporter.run().unwrap();
// Check that each file is included or excluded correctly
files.iter().zip(desired.iter()).map(|(f, b)| {
let note_path = tmp_dir.path().clone().join(PathBuf::from(f));
assert!(note_path.exists() == *b);
}).collect()
files
.iter()
.zip(desired.iter())
.map(|(f, b)| {
let note_path = tmp_dir.path().clone().join(PathBuf::from(f));
assert!(note_path.exists() == *b);
})
.collect()
}
// This test verifies that yaml inclusion works as desired for the embedded post-processor
@ -265,13 +268,10 @@ fn test_yaml_inclusion_embedded() {
exporter.run().unwrap();
let expected =
read_to_string("tests/testdata/expected/postprocessors/yaml-filtering/included_embed.md").unwrap();
let actual = read_to_string(
tmp_dir
.path()
.clone()
.join(PathBuf::from("include_me.md")),
).unwrap();
read_to_string("tests/testdata/expected/postprocessors/yaml-filtering/included_embed.md")
.unwrap();
let actual =
read_to_string(tmp_dir.path().clone().join(PathBuf::from("include_me.md"))).unwrap();
assert_eq!(expected, actual);
}
}