diff options
author | Jonas Smedegaard <dr@jones.dk> | 2024-06-27 07:47:19 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2024-06-27 07:47:19 +0200 |
commit | 595fc44b8ba3dfa6ef484b02d2d6466adcc82478 (patch) | |
tree | 7be076b4d77f48a951adcbab279bfb94a69a7fc6 /Makefile | |
parent | f86e2555c42c0afbe4b34797b4de1a772fe1d5e0 (diff) |
render turtle-formattet ontology
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 39 |
1 files changed, 33 insertions, 6 deletions
@@ -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 |