From 595fc44b8ba3dfa6ef484b02d2d6466adcc82478 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 27 Jun 2024 07:47:19 +0200 Subject: render turtle-formattet ontology --- Makefile | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'Makefile') 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 ?o}' \ + -D $(1) \ + | grep -Po -m1 '#>, o=string[()]"\K[^"]+') +get_desc = $(shell \ + roqet -q -i sparql \ + -e 'SELECT ?s ?o WHERE { ?s ?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 ?o}' -D $< | grep -Po -m1 '#>, o=string[()]"\K[^"]+')) - $(eval desc = $(shell roqet -q -i sparql -e 'SELECT ?s ?o WHERE { ?s ?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 '
' >> $@
+	@echo '{{< include _$*_ttl.html >}}' >> $@
+	@echo '
' >> $@ cal-all: cal-fetch cal-render cal-publish -- cgit v1.2.3