]> git.rocketbowman.com Git - jetsam.git/commitdiff
fix: Now, I can make *html* files
authorKyle Bowman <kyle+github@rocketbowman.com>
Sat, 9 Nov 2024 19:44:09 +0000 (14:44 -0500)
committerKyle Bowman <kyle+github@rocketbowman.com>
Sat, 9 Nov 2024 19:49:25 +0000 (14:49 -0500)
Makefile
scripts/links-to-html.lua [new file with mode: 0644]

index 1c3d035d885e6d45e0b3d1ac6e4eb1d8d507da9f..d18df02bcec5bf0ec9f90c4f8975750511d5710c 100644 (file)
--- 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 (file)
index 0000000..2de3fd0
--- /dev/null
@@ -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