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