From: Kyle Bowman Date: Sat, 9 Nov 2024 19:44:09 +0000 (-0500) Subject: fix: Now, I can make *html* files X-Git-Url: https://git.rocketbowman.com/?a=commitdiff_plain;h=4a22ff80d525de626ae74aa4b22e740ecc1ce9c0;p=jetsam.git fix: Now, I can make *html* files --- diff --git a/Makefile b/Makefile index 1c3d035..d18df02 100644 --- a/Makefile +++ b/Makefile @@ -31,16 +31,17 @@ builddirs := $(patsubst $(SRC_DIR)%, $(BUILD_DIR)%, $(subdirs)) # you must go through a second phase of expansion. The $$ defers expansion # until the second phase. Single $ can be expanded on the first phase. .SECONDEXPANSION: -$(builddirs): $$(patsubst $(SRC_DIR)%.md, $(BUILD_DIR)%, $$(shell find -L $$(patsubst $(BUILD_DIR)%, $(SRC_DIR)%, $$@) -name '*.md')) +$(builddirs): $$(patsubst $(SRC_DIR)%.md, $(BUILD_DIR)%.html, $$(shell find -L $$(patsubst $(BUILD_DIR)%, $(SRC_DIR)%, $$@) -name '*.md')) # For a given md file in src, make the corresponding html in build. -$(BUILD_DIR)/%: $(SRC_DIR)/%.md +$(BUILD_DIR)/%.html: $(SRC_DIR)/%.md @mkdir -p $(dir $@) @pandoc \ --to=html5 \ --standalone \ --defaults=./defaults.yml \ - --output=$@ $< + --output=$@ $< \ + --lua-filter=scripts/links-to-html.lua @echo "Building $@ from $<..." # Clean up generated HTML files diff --git a/scripts/links-to-html.lua b/scripts/links-to-html.lua new file mode 100644 index 0000000..2de3fd0 --- /dev/null +++ b/scripts/links-to-html.lua @@ -0,0 +1,6 @@ +-- links-to-html.lua +-- From https://stackoverflow.com/a/49396058 +function Link(el) + el.target = string.gsub(el.target, "%.md", ".html") + return el +end \ No newline at end of file