aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 24a7ef95e91ae4c61b5c5f63d486f8b90e32e9e9 (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 lint-sdml
  83. lint-markdown:
  84. @mdl --ignore-front-matter --style .mdl.rb $(filter-out %/index.qmd,$(wildcard $(addsuffix /*.qmd,$(TIDY_MARKDOWN))))
  85. lint-sdml:
  86. sdml validate learn
  87. sdml validate learn10tac
  88. sdml validate learntrap
  89. sdml validate waste
  90. tidy: tidy-bibtex tidy-perl
  91. tidy-bibtex: ref.bib
  92. bin/biblatex-tidy $<
  93. tidy-perl:
  94. perltidy -b -bext='/' --profile=.perltidyrc $(PERL_FILES)
  95. $(ARTICLES:%=screening-of-%): screening-of-%:
  96. QUARTO_LOG_LEVEL=quiet \
  97. quarto render $*/index.qmd --to man --output - | man -l -
  98. $(ARTICLES:%=wordcount-of-%): wordcount-of-%:
  99. QUARTO_LOG_LEVEL=quiet \
  100. quarto render $*/index.qmd --to plain --columns=9999 --output - \
  101. | perl -nE 'next if /^-*$$/; $$bilag += $$_ =~ "^Bilag\\b"; $$chars += length unless $$bilag; END { say $$chars }'
  102. $(ARTICLES:%=turtle-from-%): turtle-from-%:
  103. @bin/xmp2rdfxml _site/$*/S*.pdf \
  104. | rapper -i rdfxml -o turtle - $(BASE_IRI)$*/
  105. $(ARTICLES:%=dotgraph-from-%): dotgraph-from-%:
  106. @bin/xmp2rdfxml _site/$*/S*.pdf \
  107. | rapper -i rdfxml -o dot - $(BASE_IRI)$*/
  108. diff-all: $(ARTICLES:%=diff-of-%)
  109. $(ARTICLES:%=diff-of-%): diff-of-%: %/changes.tex
  110. $(ARTICLES:%=%/changes.tex): %/changes.tex: %/a.tex %/b.tex
  111. latexdiff --type CULINECHBAR --subtype COLOR --replace-context2cmd '' $^ > $*/changes.tex
  112. perl -i -pe 's/\[pdftex\]{changebar}/[luatex]{changebar}/g' $*/changes.tex
  113. latexmk --gg --lualatex --cd --silent --Werror $*/changes.tex
  114. find $*/ -name 'changes.*' -not -name changes.pdf -delete
  115. rm -f $^
  116. $(ARTICLES:%=%/a.tex): %/a.tex:
  117. git switch --detach $(shell git describe --tags --abbrev=0)
  118. QUARTO_LOG_LEVEL=quiet \
  119. quarto render $*/index.qmd --to pdf -M keep-tex:true --output a.pdf
  120. mv --force $*/index.tex $@
  121. rm --force _site/a.pdf
  122. $(ARTICLES:%=%/b.tex): %/b.tex:
  123. git switch -
  124. QUARTO_LOG_LEVEL=quiet \
  125. quarto render $*/index.qmd --to pdf -M keep-tex:true --output b.pdf
  126. mv --force $*/index.tex $@
  127. rm --force _site/b.pdf
  128. %/concepts.svg: %/core.sdm
  129. sdml draw --diagram concepts -i $< -f svg -o $@
  130. %/er.svg: %/core.sdm
  131. sdml draw --diagram entity-relationship -i $< -f svg -o $@
  132. %/uml.svg: %/core.sdm
  133. sdml draw --diagram uml-class -i $< -f svg -o $@
  134. %.ttl: %.sdm
  135. sdml --no-color convert -i $< -f rdf -o $@
  136. %/core.puml: %/core.ttl %/prefixes.ttl
  137. rdfpuml $<
  138. %/core.png: %/core.puml
  139. plantuml -tpng $<
  140. %/core.svg: %/core.puml
  141. plantuml -tsvg $<
  142. %/rdfs.svg: %/core.ttl
  143. rdfs2dot -f turtle $< | dot -Tsvg -o$@
  144. learn/%_rdfs.svg: learn/%.ttl
  145. rdfs2dot -f turtle $< | dot -Tsvg -o$@
  146. learn/all_rdfs.svg: learn/core.ttl $(ONTOLOGIES_LEARN:%=learn/%.ttl)
  147. rdfs2dot -f turtle $^ | dot -Tsvg -o$@
  148. %/rdfs.tex: %/core.ttl
  149. rdfs2dot -f turtle $< | dot2tex --figonly -o$@
  150. learn/%_rdfs.tex: learn/%.ttl
  151. rdfs2dot -f turtle $< | dot2tex --figonly -o$@
  152. learn/all_rdfs.tex: learn/core.ttl $(ONTOLOGIES_LEARN:%=learn/%.ttl)
  153. rdfs2dot -f turtle $^ | dot2tex --figonly -o$@
  154. ex/%.puml: ex/%.ttl ex/prefixes.ttl
  155. rdfpuml $<
  156. ex/%.png: ex/%.puml
  157. plantuml -tpng $<
  158. ex/%.svg: ex/%.puml
  159. plantuml -tsvg $<
  160. %/docs/index.html: %/core.ttl
  161. mkdir --parents $*/docs
  162. ontospy gendocs --type 2 -x -o $(CURDIR)/$*/docs $<
  163. $(ONTOLOGIES:%=view-%-concept-diagram): view-%-concept-diagram: %/concepts.svg
  164. inkview $<
  165. $(ONTOLOGIES:%=view-%-er-diagram): view-%-er-diagram: %/er.svg
  166. inkview $<
  167. $(ONTOLOGIES:%=view-%-uml-diagram): view-%-uml-diagram: %/uml.svg
  168. inkview $<
  169. $(ONTOLOGIES:%=view-%-rdfs-graf): view-%-rdfs-graf: %/core.ttl
  170. rdfs2dot -f turtle $< | xdot -
  171. $(ONTOLOGIES_LEARN:%=view-learn_%-rdfs-graf): view-learn_%-rdfs-graf: learn/%.ttl
  172. rdfs2dot -f turtle $< | xdot -
  173. view-learn_avoid-rdfs-graf: $(patsubst %,learn/%.ttl,bisected trap)
  174. rdfs2dot -f turtle $^ | xdot -
  175. view-learn_all-rdfs-graf: learn/core.ttl $(ONTOLOGIES_LEARN:%=learn/%.ttl)
  176. rdfs2dot -f turtle $^ | xdot -
  177. view-learn_worlding-rdfs-graf: $(ONTOLOGIES_LEARN:%=learn/%.ttl)
  178. rdfs2dot -f turtle $^ | xdot -
  179. #$(ONTOLOGIES:%=view-%-puml-diagram): view-%-puml-diagram: %/core.svg
  180. # inkview $<
  181. $(ONTOLOGIES:%=view-%-puml-diagram): view-%-puml-diagram: %/core.png
  182. imv-wayland $<
  183. $(GRAPHS:%=view-%-puml-diagram): view-%-puml-diagram: ex/%.png
  184. imv-wayland $<
  185. $(ONTOLOGIES:%=render-%-ontology): render-%-ontology: %/docs/index.html