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