From ddc64e0053103433b742be86ba4333ed22ccf7d1 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Mon, 3 Aug 2026 12:48:30 +0100 Subject: prettify wordcounts --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f7a1867..c750f5a 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ chapter_wordcounts = $(foreach chapter_index,$(CHAPTER_INDICES),$(chapter_wordco chapter_wordcounts_sum = $$(( $(addsuffix " +",$(chapter_wordcounts)) 0 )) dissertation_wordcount = $(shell cat $(DISSERTATION_WORDCOUNT_FILE)) dissertation_no_references_wordcount = $(shell cat $(DISSERTATION_NO_REFERENCES_WORDCOUNT_FILE)) +prettify_wordcount = $(shell printf "%'i" $(1)) footnotes_wordcount = $$(( $(dissertation_no_references_wordcount) - $(chapter_wordcounts_sum) )) references_wordcount = $$(( $(dissertation_wordcount) - $(dissertation_no_references_wordcount) )) chapter_title = $(shell head -n 1 $(chapter_markdown_file) | cut -c4-) @@ -116,13 +117,13 @@ $(DISSERTATION_MARKDOWN): $(DISSERTATION_FRONTMATTER) $(CHAPTER_MARKDOWN_FILES) .PHONY: wordcount wordcount: $(CHAPTER_WORDCOUNT_FILES) $(DISSERTATION_WORDCOUNT_FILE) $(DISSERTATION_NO_REFERENCES_WORDCOUNT_FILE) $(foreach chapter_index,$(CHAPTER_INDICES), \ - echo "$(chapter_title): $(chapter_wordcount)"; \ + echo "$(chapter_title): $(call prettify_wordcount,$(chapter_wordcount))"; \ ) - echo "Footnotes: $(footnotes_wordcount)" + echo "Footnotes: $(call prettify_wordcount,$(footnotes_wordcount))" echo "--------------------------------" - echo "Total: $(dissertation_no_references_wordcount)" + echo "Total: $(call prettify_wordcount,$(dissertation_no_references_wordcount))" echo "--------------------------------" - echo "(References: $(references_wordcount))" + echo "(References: $(call prettify_wordcount,$(references_wordcount)))" $(CHAPTER_WORDCOUNT_FILE_PATTERN): $(CHAPTER_MARKDOWN_FILE_PATTERN) $(WORDCOUNT_FILTER) pandoc --lua-filter $(WORDCOUNT_FILTER) $< > $@ @@ -162,7 +163,7 @@ $(COVER_SHEET_COMPLETE_PDF): $(COVER_SHEET_COMPLETE_ODT) $(COVER_SHEET_COMPLETE_ODT): $(COVER_SHEET_TEMPLATE_ODT) $(DISSERTATION_NO_REFERENCES_WORDCOUNT_FILE) odfdo-replace \ "{{ word_count }}" \ - "$(dissertation_no_references_wordcount)" \ + "$(call prettify_wordcount,$(dissertation_no_references_wordcount))" \ -i $(COVER_SHEET_TEMPLATE_ODT) \ -o $(COVER_SHEET_COMPLETE_ODT) -- cgit v1.2.3