# if someone can come up with something better then i'd appreciate that. # For now this is a bit complex but it gets the job done. # It's still a ticking time bomb and I hope we can fix it before it explodes. # Even if it explodes, it won't be that big of a deal. # Input dir describes the directory that has the markdown we want to convert # Static dir describes the directory that has files we should simply copy as-is # Output dir describes the directory that we want our final result to be in. INPUT_DIR=content STATIC_DIR=static OUTPUT_DIR=output UTILS_DIR=utils # The pandoc template to use TEMPLATE=$(UTILS_DIR)/template.html # The pandoc lua filter to use # The language code and file extension will be appended later FILTER=$(UTILS_DIR)/link-filter. ## You should not need to change anything beyond this line STATIC=$(patsubst $(STATIC_DIR)/%,$(OUTPUT_DIR)/%,$(shell find $(STATIC_DIR) -type f)) OUTPUT=$(patsubst $(INPUT_DIR)/%.md,$(OUTPUT_DIR)/%/index.html,$(shell find $(INPUT_DIR) -type f)) # The last one is for the autogenerated authors thing. site: $(OUTPUT) $(STATIC) $(OUTPUT_DIR)/authors/index.html # This generates the authors file. $(OUTPUT_DIR)/authors/index.html: $(UTILS_DIR)/authors.md mkdir -p $(dir $@) pandoc --from markdown+smart+yaml_metadata_block+auto_identifiers -V lastmod="$(shell git log --follow --format=%ad --date default $< | tail -1)" --to html --template $(TEMPLATE) $< -o $@ # Generate normal markdown $(OUTPUT_DIR)/%/index.html: $(INPUT_DIR)/%.md $(TEMPLATE) mkdir -p $(dir $@) pandoc --from markdown+smart+yaml_metadata_block+auto_identifiers -V lastmod="$(shell git log --follow --format=%ad --date default $< | tail -1)" --lua-filter=$(FILTER)$(shell echo $@ | cut -d / -f 2).lua --to html --template $(TEMPLATE) $< -o $@ @# Pandoc indenting causes too many issues. From https://stackoverflow.com/a/68633114 sed -i 's/^\s*