From e72a18dc66236232970a52fdac1bbb6f1ce4b39a Mon Sep 17 00:00:00 2001 From: Michel Boucey Date: Sun, 20 Aug 2023 17:41:19 +0200 Subject: [PATCH] Some other enhancements --- Makefile | 10 ++++++---- main.go | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index cbdbbf7..cb098d5 100644 --- a/Makefile +++ b/Makefile @@ -11,21 +11,23 @@ help: build: @echo ${BUILD} - ${MV} - @echo && dumber -v || echo clean: rm -f test/*numbered-sections* distclean: clean - rm -f ${HOME}/go/bin/dumber + rm -f dumber ${HOME}/go/bin/dumber +install: build + ${MV} + @echo && dumber -v || echo + watch: @which CompileDaemon > /dev/null 2>&1 || (echo "CompileDaemon is required to watch (https://github.com/githubnemo/CompileDaemon)."; exit 1) CompileDaemon -build "${BUILD}" -command "${MV}" .PHONY: test -test: build +test: install test/run @echo diff --git a/main.go b/main.go index 941d1ed..0f6211a 100644 --- a/main.go +++ b/main.go @@ -208,8 +208,8 @@ func main() { } func toToCEntry(r *regexp.Regexp, l string) string { - ms := r.FindStringSubmatch(l) - return (strings.Repeat(" ", len(ms[1])-1) + "- [" + ms[2] + "](#" + strings.ToLower(strings.ReplaceAll(ms[2], ".", "")+"-"+strings.ReplaceAll(ms[3], " ", "-")) + ") " + ms[3]) + m := r.FindStringSubmatch(l) + return (strings.Repeat(" ", len(m[1])-1) + "- [" + m[2] + "](#" + strings.ToLower(strings.ReplaceAll(m[2], ".", "")+"-"+strings.ReplaceAll(m[3], " ", "-")) + ") " + m[3]) } func addSectionChunk(s *string, hc int, cht int, ht int) {