diff options
| author | Joe Carstairs <me@joeac.net> | 2026-08-03 12:48:30 +0100 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2026-08-03 12:48:30 +0100 |
| commit | ddc64e0053103433b742be86ba4333ed22ccf7d1 (patch) | |
| tree | 64c39ce72a2bf227cca7a53d0ecaf85f719b30d3 | |
| parent | 6bc9b6293e2d782742e21e597002acef3aac120c (diff) | |
prettify wordcounts
| -rw-r--r-- | Makefile | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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) |
