From 731f71610d6bac11e4997246475174d639a1c58d Mon Sep 17 00:00:00 2001 From: Alvie Rahman Date: Sat, 1 May 2021 11:48:04 +0100 Subject: [PATCH] add config option to set name --- notes2web | 11 ++++++++--- readme.md | 12 ++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/notes2web b/notes2web index 0b02de1..db9d1ce 100755 --- a/notes2web +++ b/notes2web @@ -2,6 +2,11 @@ [[ "$1" == "--help" ]] && echo "USAGE: $0 [NOTES_DIRECTORY_1 [NOTES_DIRECTORY_2 [...]]]" && exit 0 +for configpath in "$HOME/.notes2web.conf" "$HOME/.config/notes2web/config" ".notes2web.conf" +do + [[ -f "$configpath" ]] && source "$configpath" +done + function _renderarticle { echo "rendering $1" pandoc\ @@ -41,9 +46,9 @@ do done # create an intermediate markdown file of links to each article -echo "--- -title: alv's notes ----" > index.md +echo "---" > index.md +[[ -z "$name" ]] && echo "title: notes" >> index.md || echo "title: ${name}'s notes" >> index.md +echo "---" >> index.md for file in "$@" do diff --git a/readme.md b/readme.md index 20b1850..56b4ad7 100644 --- a/readme.md +++ b/readme.md @@ -19,6 +19,18 @@ root directory. Then you just have to point a webserver at your notes directory. +## Config + +`notes2web` looks for a config file called `.notes2web.conf` in your current directory and your home +directory. +Right now the only config available is `name`: + +```bash +name="alv" +``` + +If the name is not set, the title is set to 'notes'. + ## Uninstall ```