From 9e6d4b21e3646d6d19e08ee66dcc0907218d72bb Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Wed, 26 Jun 2024 16:34:39 +0200 Subject: generate color-hightlighted html representation of SDML source files --- .gitignore | 2 ++ Makefile | 13 ++++++++++ styles/main.scss | 3 +++ styles/sdml.scss | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 styles/sdml.scss diff --git a/.gitignore b/.gitignore index a23c38a..859b1ca 100644 --- a/.gitignore +++ b/.gitignore @@ -11,10 +11,12 @@ svg-inkscape/ /learn/*/*.ttl /learn/*.ttl /learn/*.pdf +/learn/*.qmd /learn/*.puml /learn/*.png /learn/*.svg /learn/*.tex +/learn/_*.html /waste/*.ttl /waste/*.puml /waste/*.png diff --git a/Makefile b/Makefile index 397a39b..fef2d4c 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ publish: rsync -avH --delete-after _site/ $(BASE_SSH) prepare: \ + $(patsubst %,learn/%.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))) @@ -47,6 +48,18 @@ 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 $< -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[^"]+')) + @echo '---' > $@ + @echo 'title: $(title)' >> $@ + @echo 'subtitle: SDML source' >> $@ + @echo '---' >> $@ + @echo '$(desc)' >> $@ + @echo >> $@ + @echo '{{< include _$*.html >}}' >> $@ + cal-all: cal-fetch cal-render cal-publish cal-fetch: diff --git a/styles/main.scss b/styles/main.scss index cb90dff..a07aec4 100644 --- a/styles/main.scss +++ b/styles/main.scss @@ -13,6 +13,9 @@ $headings-font-family: $font-family-sans-serif; $display-font-family: $font-family-sans-serif; $input-btn-font-family: $font-family-sans-serif; +@import "sdml"; +@include sdml; + /*-- scss:mixins --*/ @mixin font-face($name, $style, $weight, $basedir, $file) { diff --git a/styles/sdml.scss b/styles/sdml.scss new file mode 100644 index 0000000..592a598 --- /dev/null +++ b/styles/sdml.scss @@ -0,0 +1,79 @@ +@mixin sdml { + +pre code.sdml { + font-family: "InconsolataN",monospace; +// font-size: .9em; +// font-weight: 300; +// line-height: 1.4; + padding: .6em; + border: 1px solid #e1e4e5; + white-space: pre; +} + +pre code.sdml span.comment { + color: #949494; + font-style: italic; +} + +pre code.sdml span.constant-builtin { + color: #5f5f00; +} + +pre code.sdml span.error { + color: #ff0000; +} + +pre code.sdml span.function-call { + color: #005fd7; +} + +pre code.sdml span.keyword { + color: #878700; +} + +pre code.sdml span.operator { + color: #4e4e4e; + font-weight: bold; +} + +pre code.sdml span.module { + color: #005faf; +} + +pre code.sdml span.module-definition { + color: #0000af; +} + +pre code.sdml span.number { + color: #5f5f00; +} + +pre code.sdml span.property { + color: #d70000; +} + +pre code.sdml span.punctuation-bracket { + color: #4e4e4e; +} + +pre code.sdml span.string { + color: #5faf00; +} + +pre code.sdml span.string-special { + color: #8700d7; +} + +pre code.sdml span.type { + color: #005fff; +} + +pre code.sdml span.type-definition { + color: #0000ff; +} + +pre code.sdml span.variable-field { + color: #5f87af; +} + +} -- cgit v1.2.3