blob: a6c98ccc28236af9ae5309af9d41e95614041fa4 (
plain)
- infiles := $(wildcard data/*.ttl data/*/*.ttl)
- turtlefiles := $(infiles:data/%.ttl=build/%/index.ttl)
- textfiles = $(turtlefiles:%.ttl=%.txt)
- rdfxmlfiles = $(turtlefiles:%.ttl=%.rdf)
- # TODO: resolve event:Event with prog:Programme being foaf:primaryTopic of <>
- htmlprogrammefiles = build/2014/europe/index.html
- htmlfiles = $(htmlprogrammefiles)
- getbase = $(shell perl -ne '/^\@base\s+<(http.+)>/ and print $$1 and exit;' "$1")
- all: $(textfiles) $(rdfxmlfiles) $(htmlfiles)
- clean:
- rm -rf build
- $(turtlefiles): build/%/index.ttl : data/%.ttl
- mkdir -p $(dir $@)
- cp $< $@
- # $(eval base = $(call getbase, $<))
- # rapper $(base:%=-I "%") -i turtle -o turtle "$<" > "$@"
- # perl -i -pe 's/ {4}/\t/g' "$@"
- $(textfiles): %.txt : %.ttl
- ln -fs $(notdir $<) $@
- $(rdfxmlfiles): %.rdf : %.ttl
- $(eval base = $(call getbase, $<))
- rapper $(base:%=-I "%") -i turtle -o rdfxml-abbrev "$<" > "$@"
- # Fetch and tidy programme rendering
- # * add doctype and title to validate
- # * add charset to not rely on server hinting
- # * refer to plaintext serialization (not self) of dataset
- $(htmlprogrammefiles): %.html : %.ttl
- $(eval base = $(call getbase, $<))
- wget -O"$@" "http://programme.ecs.soton.ac.uk/tool.php?src=$(base)"
- perl -pi -0 \
- -e 's,^(.*?<h1[^>]*>)(.*?)(?=</h1>),<!DOCTYPE html>\n<meta charset="utf-8">\n<title>$$2</title>$$1$$2,ms;' \
- -e 's,$(base)\K,/index.txt,;' \
- "$@"
|