]> Lady’s Gitweb - Shrine-XSLT/commitdiff
Copy over data files from sources/ 0.2.0
authorLady <redacted>
Sat, 10 Dec 2022 04:49:34 +0000 (20:49 -0800)
committerLady <redacted>
Sat, 29 Apr 2023 03:04:49 +0000 (20:04 -0700)
GNUmakefile
README.markdown

index ecf9f9d6399e5c51cd38ef2f96133aff25bcf433..b8bbd4a0820324b743afbb39c17e36f8e7b7d8d1 100644 (file)
@@ -5,6 +5,7 @@ SHELL = /bin/sh
 # • For files with a location of `sources/index.xml` or `sources/index-*.xml`, the transformed file will be written to `public/%.html` (where `%` is the filename).
 #
 # • For all other files with a location of `sources/*.xml` or `sources/*/*.xml`, the transformed file will be written to `public/%/index.html` (where `%` is the filename and subdirectory if applicable).
+# Other files in the corresponding directory (i·e without the `.xml`) are copied over verbatim.
 # Only one level of subdirectory is supported.
 #
 # By default, running `make` will do this for all applicable source files.
@@ -29,11 +30,14 @@ override indices := $(patsubst sources/%.xml,public/%.html,$(indexsources))
 override pagesources := $(filter-out $(indexsources),$(wildcard sources/*.xml sources/*/*.xml))
 override pages := $(patsubst sources/%.xml,public/%/index.html,$(pagesources))
 
+override resourcesources := $(wildcard $(addsuffix /*,$(basename $(pagesources))))
+override resources := $(patsubst sources/%,public/%,$(resourcesources))
+
 override content := $(indices) $(pages)
 
 override makexslt = $(XSLT) --nonet --novalid $(XSLTOPTS) -o $(2) transform.xslt $(1)
 
-all: $(content) ;
+all: $(content) $(resources);
 
 $(indices): public/%.html: sources/%.xml $(prerequisites)
        @echo "Generating $@…"
@@ -43,4 +47,9 @@ $(pages): public/%/index.html: sources/%.xml $(prerequisites)
        @echo "Generating $@…"
        @$(call makexslt,$<,$@)
 
+$(resources): public/%: sources/%
+       @echo "Copying over $@…"
+       @mkdir -p $(dir $<)
+       @cp $< $@
+
 .PHONY: all ;
index c7b84ae3cd306f5e925b176dc4470d1dbe3068af..3b040d61f0bc11449938fc6e53032ca37a459667 100644 (file)
@@ -7,7 +7,6 @@ substantially changing the authoring flow.
 ## Features
 
 - Really simple shrine generation
-
 - One command: `make`
 
 ## Prerequisites
@@ -63,6 +62,10 @@ directory (which you can then serve statically from your server).
   output at `public/%/index.html` (where `%` is the filename and
   optional subdirectory). Only one level of subdirectory is supported.
 
+- For any files at `sources/*.xml` and `sources/*/*.xml`, files in the
+  folder with the same name (minus the `.xml`) will be copied over
+  verbatim.
+
 - The transformation doesn’t do any rewriting of links. Make sure you
   write them to point to the *final* location of the files, not their
   location within the `sources/` directory.
This page took 0.024208 seconds and 4 git commands to generate.