summaryrefslogtreecommitdiff
path: root/Makefile
blob: 7e9d11abefd58ec13f43314f5a79df1120ca4b92 (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 = build/2014/europe/index.html
  7. htmlfiles = $(htmlprogrammefiles)
  8. getbase = $(shell perl -ne '/^\@base\s+<(http.+)>/ and print $$1 and exit;' "$1")
  9. all: $(textfiles) $(rdfxmlfiles) $(htmlfiles)
  10. clean:
  11. rm -rf build
  12. $(turtlefiles): build/%/index.ttl : data/%.ttl
  13. mkdir -p $(dir $@)
  14. cp $< $@
  15. # $(eval base = $(call getbase, $<))
  16. # rapper $(base:%=-I "%") -i turtle -o turtle "$<" > "$@"
  17. # perl -i -pe 's/ {4}/\t/g' "$@"
  18. $(textfiles): %.txt : %.ttl
  19. ln -fs $(notdir $<) $@
  20. $(rdfxmlfiles): %.rdf : %.ttl
  21. $(eval base = $(call getbase, $<))
  22. rapper $(base:%=-I "%") -i turtle -o rdfxml-abbrev "$<" > "$@"
  23. # Fetch and tidy programme rendering
  24. # * add doctype and title to validate
  25. # * add charset to not rely on server hinting
  26. # * refer to plaintext serialization (not self) of dataset
  27. $(htmlprogrammefiles): %.html : %.ttl
  28. $(eval base = $(call getbase, $<))
  29. wget -O"$@" "http://programme.ecs.soton.ac.uk/tool.php?src=$(base)"
  30. perl -pi -0 \
  31. -e 's,^(.*?<h1[^>]*>)(.*?)(?=</h1>),<!DOCTYPE html>\n<meta charset="utf-8">\n<title>$$2$$1$$2,ms;' \
  32. -e 's,$(base)\K,/index.txt,;' \
  33. "$@"