From 37df47cf3bd21bf0f552c5cd85ff0336c2e473ef Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Wed, 12 Feb 2025 15:37:05 +0100 Subject: [PATCH] fix mark article target --- Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 5eefb86..d7f7560 100644 --- a/Makefile +++ b/Makefile @@ -41,13 +41,14 @@ database: $(default) ## Make a recfiles database .PHONY: article article: ## Write an article - @path=$$(find . -type d -printf '%P\n' | $(FZF)); \ - read -p "Title: " title; \ - printf '%s\n' '---' >> $$path/$$title.md ; \ - printf 'title: "%s"\n' "$$title" >> $$path/$$title.md ; \ - printf 'tags: [ "%s" ]\n' "$$path" | sed 's#\/#", "#g' >> $$path/$$title.md ; \ - printf '%s\n\n' '---' >> $$path/$$title.md ;\ - $(EDITOR) +5 $$path/$$title.md + @path=$$(find . -type d -printf '%P\n' | $(FZF)) ;\ + read -p "Title: " title ;\ + filename="$$(echo "$$title" | tr '[:upper:]' '[:lower:]' | tr ' ' '_')" ;\ + printf '%s\n' '---' >> $$path/$$filename.md ;\ + printf 'title: "%s"\n' "$$title" >> $$path/$$filename.md ;\ + printf 'tags: [ "%s" ]\n' "$$path" | sed 's#\/#", "#g' >> $$path/$$filename.md ;\ + printf '%s\n\n' '---' >> $$path/$$filename.md ;\ + $(EDITOR) +5 "$$path/$$filename.md" .PHONY: clean clean: ## Remove all generated files