aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: fef2d4ca0b54b212e8af8375daeb9ac68cb1b261 (plain)
  1. SSH_HOST = www-ruc@xayide.jones.dk
  2. SSH_BASE_PATH = public_websites/thoughtroam.abcde.../
  3. BASE_SSH = $(SSH_HOST):$(SSH_BASE_PATH)
  4. BASE_IRI = https://thoughtroam.abcdefghijklmnopqrstuvxyzæøå.dk/
  5. BASE_URI = https://thoughtroam.xn--abcdefghijklmnopqrstuvxyz-0fc0a81c.dk/
  6. #PAD_ARTICLES = worlding
  7. ARTICLES = waste worlding
  8. ONTOLOGIES = learn waste
  9. ONTOLOGIES_LEARN = tentacular bisected trap
  10. ONTOLOGIES_VERSION = 0.1
  11. GRAPHS = $(patsubst ex/%.ttl,%,$(wildcard ex/*.ttl))
  12. PERL_FILES = bin/biblatex-tidy bin/hedgedoc2quarto bin/xmp2rdfxml
  13. TIDY_MARKDOWN = worlding
  14. export HEDGEDOC_COOKIES_FILE = $(CURDIR)/cookies.txt
  15. export HEDGEDOC_SERVER = https://pad.degrowth.net/
  16. all: preview
  17. preview:
  18. quarto preview
  19. render:
  20. quarto render
  21. publish:
  22. rsync -avH --delete-after _site/ $(BASE_SSH)
  23. prepare: \
  24. $(patsubst %,learn/%.qmd,core $(ONTOLOGIES_LEARN)) \
  25. $(patsubst %,learn/$(ONTOLOGIES_VERSION)/%.ttl,core $(ONTOLOGIES_LEARN)) \
  26. $(foreach ext,svg tex,learn/rdfs.$(ext)) \
  27. $(foreach dia,tentacular trap all,$(foreach ext,svg tex,learn/$(dia)_rdfs.$(ext)))
  28. learn/$(ONTOLOGIES_VERSION)/%.ttl: learn/%.ttl
  29. mkdir --parents learn/0.1
  30. perl -gp \
  31. -e 's,\b$(subst bisected,learn2sect,$(subst tentacular,learn10tac,$(subst core,learn,$*))):,:,g;' \
  32. -e 's,\Q$(BASE_URI)stub/foaf#,http://xmlns.com/foaf/0.1/,g;' \
  33. -e 's,\Q$(BASE_URI)stub/doap#,http://usefulinc.com/ns/doap#,g;' \
  34. -e 's,purl\.org/learn/\K(?=[^\d]),$(ONTOLOGIES_VERSION)/,g;' \
  35. -e 's,\n\s*owl:imports\s[^\n]+;(?=\n),,g;' \
  36. < $< > $@
  37. learn/%.qmd: learn/$(ONTOLOGIES_VERSION)/%.ttl
  38. sdml highlight --output-format html -i $< -o learn/_$*.html
  39. $(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[^"]+'))
  40. $(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[^"]+'))
  41. @echo '---' > $@
  42. @echo 'title: $(title)' >> $@
  43. @echo 'subtitle: SDML source' >> $@
  44. @echo '---' >> $@
  45. @echo '$(desc)' >> $@
  46. @echo >> $@
  47. @echo '{{< include _$*.html >}}' >> $@
  48. cal-all: cal-fetch cal-render cal-publish
  49. cal-fetch:
  50. bin/cal-fetch.sh
  51. cal-render:
  52. bin/cal-publish.sh
  53. cal-publish:
  54. ssh $(SSH_HOST) mkdir -p $(SSH_BASE_PATH)events/
  55. rsync -avH --delete-after $(patsubst %,events/%,$(ARTICLES) superteam) $(BASE_SSH)events/
  56. pad-login:
  57. hedgedoc login --email
  58. pad-list:
  59. hedgedoc history
  60. pad-export-all: $(PAD_ARTICLES:%=pad-export-%)
  61. pad-export-worlding: ref.bib worlding/index.qmd \
  62. $(patsubst %,worlding/_%.qmd,baggrund teori_og_metode undersøgelser konklusion perspektivering kilder planer)
  63. ref.bib:
  64. hedgedoc export --md 8krqOrqnR0iAIExDTtTrxw $@
  65. perl -g -e 's/\s*\z/\n/' $@
  66. worlding/index.qmd:
  67. hedgedoc export --md MJei_2e-SjahCtmRT-xiPw $@
  68. perl -g -e 's/\s*\z/\n/' $@
  69. worlding/_baggrund.qmd:
  70. hedgedoc export --md mGHhKvXyQ5SVeTIU11isQQ $@
  71. perl -g -e 's/\s*\z/\n/' $@
  72. worlding/_teori_og_metode.qmd:
  73. hedgedoc export --md 5AbKoR-mTOij6TsCMFFDRw $@
  74. perl -g -e 's/\s*\z/\n/' $@
  75. worlding/_undersøgelser.qmd:
  76. hedgedoc export --md 5XR69V5rSEm9LwsLNtSXcQ $@
  77. perl -g -e 's/\s*\z/\n/' $@
  78. worlding/_konklusion.qmd:
  79. hedgedoc export --md ofRbx2f4QcWLR-o_kqTNCQ $@
  80. perl -g -e 's/\s*\z/\n/' $@
  81. worlding/_perspektivering.qmd:
  82. hedgedoc export --md lU8aUxCkR5GNrP-8frklFA $@
  83. perl -g -e 's/\s*\z/\n/' $@
  84. worlding/_kilder.qmd:
  85. hedgedoc export --md Jt6S4tAhQM-BUrAP-OllCg $@
  86. perl -g -e 's/\s*\z/\n/' $@
  87. worlding/_planer.qmd:
  88. hedgedoc export --md qfFl3xiaQWCbpoyNPbNsEA $@~
  89. bin/hedgedoc2quarto $@~ $@
  90. $(PAD_ARTICLES:%=pad-import-%): pad-import-%:
  91. hedgedoc import $*/index.qmd
  92. pad-import-ref:
  93. hedgedoc import ref.bib
  94. lint: lint-markdown lint-sdml
  95. lint-markdown:
  96. @mdl --ignore-front-matter --style .mdl.rb $(filter-out %/index.qmd,$(wildcard $(addsuffix /*.qmd,$(TIDY_MARKDOWN))))
  97. lint-sdml:
  98. sdml validate learn
  99. sdml validate learn10tac
  100. sdml validate learntrap
  101. sdml validate waste
  102. tidy: tidy-bibtex tidy-perl
  103. tidy-bibtex: ref.bib
  104. bin/biblatex-tidy $<
  105. tidy-perl:
  106. perltidy -b -bext='/' --profile=.perltidyrc $(PERL_FILES)
  107. $(ARTICLES:%=screening-of-%): screening-of-%:
  108. QUARTO_LOG_LEVEL=quiet \
  109. quarto render $*/index.qmd --to man --output - | man -l -
  110. $(ARTICLES:%=wordcount-of-%): wordcount-of-%:
  111. QUARTO_LOG_LEVEL=quiet \
  112. quarto render $*/index.qmd --to plain --columns=9999 --output - \
  113. | perl -nE 'next if /^-*$$/; $$bilag += $$_ =~ "^Bilag\\b"; $$chars += length unless $$bilag; END { say $$chars }'
  114. $(ARTICLES:%=turtle-from-%): turtle-from-%:
  115. @bin/xmp2rdfxml _site/$*/S*.pdf \
  116. | rapper -i rdfxml -o turtle - $(BASE_IRI)$*/
  117. $(ARTICLES:%=dotgraph-from-%): dotgraph-from-%:
  118. @bin/xmp2rdfxml _site/$*/S*.pdf \
  119. | rapper -i rdfxml -o dot - $(BASE_IRI)$*/
  120. diff-all: $(ARTICLES:%=diff-of-%)
  121. $(ARTICLES:%=diff-of-%): diff-of-%: %/changes.tex
  122. $(ARTICLES:%=%/changes.tex): %/changes.tex: %/a.tex %/b.tex
  123. latexdiff --type CULINECHBAR --subtype COLOR --replace-context2cmd '' $^ > $*/changes.tex
  124. perl -i -pe 's/\[pdftex\]{changebar}/[luatex]{changebar}/g' $*/changes.tex
  125. latexmk --gg --lualatex --cd --silent --Werror $*/changes.tex
  126. find $*/ -name 'changes.*' -not -name changes.pdf -delete
  127. rm -f $^
  128. $(ARTICLES:%=%/a.tex): %/a.tex:
  129. git switch --detach $(shell git describe --tags --abbrev=0)
  130. QUARTO_LOG_LEVEL=quiet \
  131. quarto render $*/index.qmd --to pdf -M keep-tex:true --output a.pdf
  132. mv --force $*/index.tex $@
  133. rm --force _site/a.pdf
  134. $(ARTICLES:%=%/b.tex): %/b.tex:
  135. git switch -
  136. QUARTO_LOG_LEVEL=quiet \
  137. quarto render $*/index.qmd --to pdf -M keep-tex:true --output b.pdf
  138. mv --force $*/index.tex $@
  139. rm --force _site/b.pdf
  140. %/concepts.svg: %/core.sdm
  141. sdml draw --diagram concepts -i $< -f svg -o $@
  142. %/er.svg: %/core.sdm
  143. sdml draw --diagram entity-relationship -i $< -f svg -o $@
  144. %/uml.svg: %/core.sdm
  145. sdml draw --diagram uml-class -i $< -f svg -o $@
  146. %.ttl: %.sdm
  147. sdml --no-color convert -i $< -f rdf -o $@
  148. # TODO: drop workaround when SDML renders syntactically correct datatype
  149. # <https://github.com/sdm-lang/rust-sdml/issues/9>
  150. perl -pi -e 's/\\"([^\\"]*)\\"(?="\^\^xsd:date\b)/$$1/g;' $@
  151. %/core.puml: %/core.ttl %/prefixes.ttl
  152. rdfpuml $<
  153. %/core.png: %/core.puml
  154. plantuml -tpng $<
  155. %/core.svg: %/core.puml
  156. plantuml -tsvg $<
  157. %/rdfs.svg: %/core.ttl
  158. rdfs2dot -f turtle $< | dot -Tsvg -o$@
  159. learn/%_rdfs.svg: learn/%.ttl
  160. rdfs2dot -f turtle $< | dot -Tsvg -o$@
  161. learn/all_rdfs.svg: learn/core.ttl $(ONTOLOGIES_LEARN:%=learn/%.ttl)
  162. rdfs2dot -f turtle $^ | dot -Tsvg -o$@
  163. %/rdfs.tex: %/core.ttl
  164. rdfs2dot -f turtle $< | dot2tex --figonly -o$@
  165. learn/%_rdfs.tex: learn/%.ttl
  166. rdfs2dot -f turtle $< | dot2tex --figonly -o$@
  167. learn/all_rdfs.tex: learn/core.ttl $(ONTOLOGIES_LEARN:%=learn/%.ttl)
  168. rdfs2dot -f turtle $^ | dot2tex --figonly -o$@
  169. ex/%.puml: ex/%.ttl ex/prefixes.ttl
  170. rdfpuml $<
  171. ex/%.png: ex/%.puml
  172. plantuml -tpng $<
  173. ex/%.svg: ex/%.puml
  174. plantuml -tsvg $<
  175. %/docs/index.html: %/core.ttl
  176. mkdir --parents $*/docs
  177. ontospy gendocs --type 2 -x -o $(CURDIR)/$*/docs $<
  178. $(ONTOLOGIES:%=view-%-concept-diagram): view-%-concept-diagram: %/concepts.svg
  179. inkview $<
  180. $(ONTOLOGIES:%=view-%-er-diagram): view-%-er-diagram: %/er.svg
  181. inkview $<
  182. $(ONTOLOGIES:%=view-%-uml-diagram): view-%-uml-diagram: %/uml.svg
  183. inkview $<
  184. $(ONTOLOGIES:%=view-%-rdfs-graf): view-%-rdfs-graf: %/core.ttl
  185. rdfs2dot -f turtle $< | xdot -
  186. $(ONTOLOGIES_LEARN:%=view-learn_%-rdfs-graf): view-learn_%-rdfs-graf: learn/%.ttl
  187. rdfs2dot -f turtle $< | xdot -
  188. view-learn_avoid-rdfs-graf: $(patsubst %,learn/%.ttl,bisected trap)
  189. rdfs2dot -f turtle $^ | xdot -
  190. view-learn_all-rdfs-graf: learn/core.ttl $(ONTOLOGIES_LEARN:%=learn/%.ttl)
  191. rdfs2dot -f turtle $^ | xdot -
  192. view-learn_worlding-rdfs-graf: $(ONTOLOGIES_LEARN:%=learn/%.ttl)
  193. rdfs2dot -f turtle $^ | xdot -
  194. #$(ONTOLOGIES:%=view-%-puml-diagram): view-%-puml-diagram: %/core.svg
  195. # inkview $<
  196. $(ONTOLOGIES:%=view-%-puml-diagram): view-%-puml-diagram: %/core.png
  197. imv-wayland $<
  198. $(GRAPHS:%=view-%-puml-diagram): view-%-puml-diagram: ex/%.png
  199. imv-wayland $<
  200. $(ONTOLOGIES:%=render-%-ontology): render-%-ontology: %/docs/index.html