summaryrefslogtreecommitdiff
path: root/Makefile
blob: ebd9a3911514fe70183b7b90af589612fb60975a (plain)
  1. infiles := $(wildcard data/*.ttl data/*/*.ttl)
  2. turtlefiles := $(infiles:data/%.ttl=build/%/index.ttl)
  3. textfiles = $(turtlefiles:%.ttl=%.txt)
  4. rdfxmlfiles = $(turtlefiles:%.ttl=%.rdf)
  5. # TODO: resolve event:Event with prog:Programme being foaf:primaryTopic of <>
  6. htmlprogrammefiles = \
  7. build/2011/cambridge/index.html \
  8. build/2011/banjaluka/index.html \
  9. build/2011/asia/index.html \
  10. build/2014/europe/index.html \
  11. build/2014/bruxelles-05/index.html \
  12. build/2014/bruxelles-05-2/index.html \
  13. build/2014/bruxelles-07/index.html \
  14. build/2014/europe-08/index.html \
  15. build/2015/brussels-03/index.html
  16. htmlfiles = $(htmlprogrammefiles)
  17. getbase = $(shell perl -ne '/^\@base\s+<(http.+)>/ and print $$1 and exit;' "$1")
  18. all: $(textfiles) $(rdfxmlfiles) $(htmlfiles)
  19. clean:
  20. rm -rf build
  21. $(turtlefiles): build/%/index.ttl : data/%.ttl
  22. mkdir -p $(dir $@)
  23. cp $< $@
  24. # $(eval base = $(call getbase, $<))
  25. # rapper $(base:%=-I "%") -i turtle -o turtle "$<" > "$@"
  26. # perl -i -pe 's/ {4}/\t/g' "$@"
  27. $(textfiles): %.txt : %.ttl
  28. ln -fs $(notdir $<) $@
  29. $(rdfxmlfiles): %.rdf : %.ttl
  30. $(eval base = $(call getbase, $<))
  31. rapper $(base:%=-I "%") -i turtle -o rdfxml-abbrev "$<" > "$@"
  32. # Fetch and tidy programme rendering
  33. # * add doctype and title to validate
  34. # * add charset to not rely on server hinting
  35. # * refer to plaintext serialization (not self) of dataset
  36. $(htmlprogrammefiles): %.html : %.ttl
  37. $(eval base = $(call getbase, $<))
  38. wget -O"$@" "http://programme.ecs.soton.ac.uk/tool.php?src=$(base)"
  39. perl -pi -0 \
  40. -e 's,^(.*?<h1[^>]*>)(.*?)(?=</h1>),<!DOCTYPE html>\n<meta charset="utf-8">\n<title>$$2</title>$$1$$2,ms;' \
  41. -e 's,$(base)\K,/index.txt,;' \
  42. -e "s,class='[^'] *\Kprogramme_current',',;" \
  43. -e "s,<div class='programme_now_message'>now</div>,,g;" \
  44. "$@"