From c7dcc0eca98d2f5976f4d2fb4b74cc0fe3474883 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 25 May 2025 13:29:31 +0200 Subject: stop depend on Markdown pager bat(cat), and prefer glow if available --- _make/quarto.mk | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/_make/quarto.mk b/_make/quarto.mk index a52f435..5e2fe8a 100644 --- a/_make/quarto.mk +++ b/_make/quarto.mk @@ -11,8 +11,11 @@ # # Dependencies: # * quarto -# * bat , with executable named "batcat" # * perl v5.10.1 or newer +# +# Suggestions: +# * glow +# * bat , with executable named "batcat" # list of relative paths to directories, # each containing an index.qmd file. @@ -27,6 +30,13 @@ DOCUMENT_APPENDIX_REGEX ?= Appendix\\b DOCUMENT_BIBLIOGRAPHY_REGEX ?= Bibliography\\b +# pick as decent a Markdown pager as locally available +_which = $(shell command -v $1 >/dev/null 2>&1 && echo $1 $2) +CAT ?= $(strip $(or \ + $(call _which,glow,--pager),\ + $(call _which,batcat,--language markdown),\ + cat)) + PDF_DOCUMENTS ?= $(patsubst %.qmd,_site/%.pdf,$(DOCUMENTS)) $(DOCUMENTS:%=doc-render-%): doc-render-%: _site/%.pdf @@ -35,7 +45,7 @@ _site/%.pdf: %.qmd $(DOCUMENTS:%=doc-screening-of-%): doc-screening-of-%: %.qmd QUARTO_LOG_LEVEL=quiet \ - quarto render $< --to markdown --output - | batcat --file-name index.qmd --language markdown + quarto render $< --to markdown --output - | $(CAT) # count all characters except horisontal rulers, # until appendices -- cgit v1.2.3