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