From d38b0a84f67506edecf053df4e24c8e1c5ecfa62 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 30 Sep 2023 01:26:24 -0400 Subject: [PATCH] Fix handling file names with periods before the file extension. --- docker/organic_test/Dockerfile | 2 +- org_mode_samples/document/category_multiple.org | 5 +++++ src/parser/document.rs | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 org_mode_samples/document/category_multiple.org diff --git a/docker/organic_test/Dockerfile b/docker/organic_test/Dockerfile index 86f3a405..5d6a6fd6 100644 --- a/docker/organic_test/Dockerfile +++ b/docker/organic_test/Dockerfile @@ -88,7 +88,7 @@ ARG DOOMEMACS_PATH=/foreign_documents/doomemacs ARG DOOMEMACS_REPO=https://github.com/doomemacs/doomemacs.git RUN mkdir -p $DOOMEMACS_PATH && git -C $DOOMEMACS_PATH init --initial-branch=main && git -C $DOOMEMACS_PATH remote add origin $DOOMEMACS_REPO && git -C $DOOMEMACS_PATH fetch origin $DOOMEMACS_VERSION && git -C $DOOMEMACS_PATH checkout FETCH_HEAD -ARG WORG_VERSION=0c8d5679b536af450b61812246a3e02b8103f4b8 +ARG WORG_VERSION=ba6cda890f200d428a5d68e819eef15b5306055f ARG WORG_PATH=/foreign_documents/worg ARG WORG_REPO=https://git.sr.ht/~bzg/worg RUN mkdir -p $WORG_PATH && git -C $WORG_PATH init --initial-branch=main && git -C $WORG_PATH remote add origin $WORG_REPO && git -C $WORG_PATH fetch origin $WORG_VERSION && git -C $WORG_PATH checkout FETCH_HEAD diff --git a/org_mode_samples/document/category_multiple.org b/org_mode_samples/document/category_multiple.org new file mode 100644 index 00000000..591cac3a --- /dev/null +++ b/org_mode_samples/document/category_multiple.org @@ -0,0 +1,5 @@ +#+CATEGORY: foo +#+CATEGORY: bar +#+begin_src text +#+CATEGORY: baz +#+end_src diff --git a/src/parser/document.rs b/src/parser/document.rs index b7d91a51..f50291c3 100644 --- a/src/parser/document.rs +++ b/src/parser/document.rs @@ -83,7 +83,7 @@ pub fn parse_file_with_settings<'g, 's, P: AsRef>( let full_path = file_path.as_ref().canonicalize()?; if doc.category.is_none() { let category = full_path - .file_prefix() + .file_stem() .expect("File should have a name.") .to_str() .expect("File name should be valid utf-8.");