aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile39
1 files changed, 33 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 29b14da..b0518e5 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,17 @@ TIDY_MARKDOWN = worlding
export HEDGEDOC_COOKIES_FILE = $(CURDIR)/cookies.txt
export HEDGEDOC_SERVER = https://pad.degrowth.net/
+get_title = $(shell \
+ roqet -q -i sparql \
+ -e 'SELECT ?s ?o WHERE { ?s <http://www.w3.org/2004/02/skos/core#prefLabel> ?o}' \
+ -D $(1) \
+ | grep -Po -m1 '#>, o=string[()]"\K[^"]+')
+get_desc = $(shell \
+ roqet -q -i sparql \
+ -e 'SELECT ?s ?o WHERE { ?s <http://purl.org/dc/elements/1.1/description> ?o }' \
+ -D $(1) \
+ | grep -Po '#>, o=string[()]"\K[^"]+')
+
all: preview
preview:
@@ -33,7 +44,8 @@ publish:
rsync -avH --delete-after _site/ $(BASE_SSH)
prepare: \
- $(patsubst %,learn/%.qmd,core $(ONTOLOGIES_LEARN)) \
+ $(patsubst %,learn/%_sdm.qmd,core $(ONTOLOGIES_LEARN)) \
+ $(patsubst %,learn/%_ttl.qmd,core $(ONTOLOGIES_LEARN)) \
$(patsubst %,learn/$(ONTOLOGIES_VERSION)/%.ttl,core $(ONTOLOGIES_LEARN)) \
$(foreach ext,svg tex,learn/rdfs.$(ext)) \
$(foreach dia,tentacular trap all,$(foreach ext,svg tex,learn/$(dia)_rdfs.$(ext)))
@@ -48,17 +60,32 @@ learn/$(ONTOLOGIES_VERSION)/%.ttl: learn/%.ttl
-e 's,\n\s*owl:imports\s[^\n]+;(?=\n),,g;' \
< $< > $@
-learn/%.qmd: learn/$(ONTOLOGIES_VERSION)/%.ttl
- sdml highlight --output-format html -i learn/$*.sdm -o learn/_$*.html
- $(eval title = $(shell roqet -q -i sparql -e 'SELECT ?s ?o WHERE { ?s <http://www.w3.org/2004/02/skos/core#prefLabel> ?o}' -D $< | grep -Po -m1 '#>, o=string[()]"\K[^"]+'))
- $(eval desc = $(shell roqet -q -i sparql -e 'SELECT ?s ?o WHERE { ?s <http://purl.org/dc/elements/1.1/description> ?o }' -D $< | grep -Po '#>, o=string[()]"\K[^"]+'))
+learn/%_sdm.qmd: learn/$(ONTOLOGIES_VERSION)/%.ttl
+ sdml highlight --output-format html -i learn/$*.sdm -o learn/_$*_sdm.html
+ $(eval title = $(call get_title,$<))
+ $(eval desc = $(call get_desc,$<))
@echo '---' > $@
@echo 'title: $(title)' >> $@
@echo 'subtitle: SDML source' >> $@
@echo '---' >> $@
@echo '$(desc)' >> $@
@echo >> $@
- @echo '{{< include _$*.html >}}' >> $@
+ @echo '{{< include _$*_sdm.html >}}' >> $@
+
+learn/%_ttl.qmd: learn/%.sdm
+# sdml convert -f rdf -i learn/$*.sdm | ansifilter --html --fragment --ignore-csi -o learn/_$*_ttl.html
+ sdml convert -f rdf -i learn/$*.sdm | ansifilter --html --fragment -o learn/_$*_ttl.html
+ $(eval title = $(call get_title,learn/$(ONTOLOGIES_VERSION)/$*.ttl))
+ $(eval desc = $(call get_desc,learn/$(ONTOLOGIES_VERSION)/$*.ttl))
+ @echo '---' > $@
+ @echo 'title: $(title)' >> $@
+ @echo 'subtitle: Turtle format' >> $@
+ @echo '---' >> $@
+ @echo '$(desc)' >> $@
+ @echo >> $@
+ @echo '<pre><code class="turtle">' >> $@
+ @echo '{{< include _$*_ttl.html >}}' >> $@
+ @echo '</code></pre>' >> $@
cal-all: cal-fetch cal-render cal-publish