updated function name to match CLI convention

This commit is contained in:
Max Schrader 2022-01-11 16:43:04 -06:00
parent 7123975297
commit e7a1005aa7
3 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
use eyre::{eyre, Result};
use gumdrop::Options;
use obsidian_export::postprocessors::{softbreaks_to_hardbreaks, create_yaml_includer};
use obsidian_export::postprocessors::{softbreaks_to_hardbreaks, create_frontmatter_filter};
use obsidian_export::{ExportError, Exporter, FrontmatterStrategy, WalkOptions};
use std::{env, path::PathBuf};
@ -115,7 +115,7 @@ fn main() {
exporter.walk_options(walk_options);
// Adding YAML export filter if
let yaml_postprocessor = create_yaml_includer(&args.front_matter_filter_key);
let yaml_postprocessor = create_frontmatter_filter(&args.front_matter_filter_key);
if args.front_matter_export_filtering {
exporter.add_postprocessor(&yaml_postprocessor);
if args.front_matter_filter_embeds {

View File

@ -21,7 +21,7 @@ pub fn softbreaks_to_hardbreaks(
/// This postprocessor converts returns a new function (closure) that searches for the specified
/// yaml_filter_key in a notes frontmatter. If it does not find a yaml_filter_key: true in the YAML,
/// it tells the exporter to StopandSkipNote
pub fn create_yaml_includer(
pub fn create_frontmatter_filter(
yaml_filter_key: &str,
) -> impl Fn(&mut Context, &mut MarkdownEvents) -> PostprocessorResult {
let key = serde_yaml::Value::String(yaml_filter_key.to_string());

View File

@ -1,4 +1,4 @@
use obsidian_export::postprocessors::{softbreaks_to_hardbreaks, create_yaml_includer};
use obsidian_export::postprocessors::{softbreaks_to_hardbreaks, create_frontmatter_filter};
use obsidian_export::{Context, Exporter, MarkdownEvents, PostprocessorResult};
use pretty_assertions::assert_eq;
use pulldown_cmark::{CowStr, Event};
@ -232,7 +232,7 @@ fn test_yaml_inclusion() {
PathBuf::from("tests/testdata/input/postprocessors/yaml-filtering"),
tmp_dir.path().to_path_buf(),
);
let yaml_postprocessor = create_yaml_includer("export");
let yaml_postprocessor = create_frontmatter_filter("export");
exporter.add_postprocessor(&yaml_postprocessor);
// Run the exporter
@ -257,7 +257,7 @@ fn test_yaml_inclusion_embedded() {
tmp_dir.path().to_path_buf(),
);
let yaml_postprocessor = create_yaml_includer("export");
let yaml_postprocessor = create_frontmatter_filter("export");
exporter.add_postprocessor(&yaml_postprocessor);
exporter.add_embed_postprocessor(&yaml_postprocessor);