From 077dd667659cc1e579977d1cca0d4fe6934b6dad Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 15 Sep 2021 20:26:52 +0300 Subject: fix: allow topic pages to contain dots Previously, a topic of lars.wirzenius would be stored in lars.mdwn, which is wrong. Now it's stored in lars.wirzenius.mdwn. Sponsored-by: author --- jt.md | 12 ++++++------ src/journal.rs | 4 +--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/jt.md b/jt.md index 2066690..4fcea5d 100644 --- a/jt.md +++ b/jt.md @@ -310,19 +310,19 @@ given an installed jt when I run jt --dirname jrnl init default "My test journal" then command is successful -when I try to run jt --editor=none --dirname=jrnl new --topic foo "Abracadabra" +when I try to run jt --editor=none --dirname=jrnl new --topic foo.bar "Abracadabra" then command fails -then stderr contains "foo" +then stderr contains "foo.bar" -when I run jt --editor=none --dirname=jrnl new-topic foo "Things about Foo" +when I run jt --editor=none --dirname=jrnl new-topic foo.bar "Things about Foobars" then command is successful -then file jrnl/foo.mdwn contains "Things about Foo" +then file jrnl/foo.bar.mdwn contains "Things about Foobars" then there are no uncommitted changes in jrnl -when I run jt --editor=none --dirname=jrnl new --topic foo "Abracadabra" +when I run jt --editor=none --dirname=jrnl new --topic foo.bar "Abracadabra" then command is successful and there is one draft in jrnl -and draft 0 in jrnl links to "foo" +and draft 0 in jrnl links to "foo.bar" ~~~ diff --git a/src/journal.rs b/src/journal.rs index c12ebfa..a48a63d 100644 --- a/src/journal.rs +++ b/src/journal.rs @@ -223,9 +223,7 @@ fn is_dir(path: &Path) -> bool { } fn topic_path(dirname: &Path, topic: &Path) -> PathBuf { - let mut path = dirname.join(topic); - path.set_extension("mdwn"); - path + dirname.join(&format!("{}.mdwn", topic.display())) } fn current_timestamp() -> String { -- cgit v1.2.1