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