Debian Codegraph @

src/storage/t2

raw
1 #!/usr/bin/env bash
2 # Export converter for web example
3
4 type="$1"
5 if [ "$type" = "authorUrl" ] ; then
6 author="$2"
7 authorText="$3"
8
9
10 declare -A authorUrl
11 authorUrl=(
12 ["Amund Kvalbein"]="https://simula.no/people/amundk"
13 ["Andreas Jungmaier"]="http://www.tdr.wiwi.uni-due.de/team/ehemalige-mitarbeiter/andreas-jungmaier/"
14 ["Carsten Hohendorf"]="http://www.tdr.wiwi.uni-due.de/team/ehemalige-mitarbeiter/carsten-hohendorf/"
15 ["Christian Henke"]="http://www.av.tu-berlin.de/menue/team/former_fellows/christian_henke/"
16 ["Daniel Bialla"]="https://www.uni-due.de/zim/organisation/mitarbeiterInnen/mitarbeiter_details.php?id=104"
17 ["Dieter Huth"]="https://www.uni-due.de/zim/organisation/mitarbeiterInnen/mitarbeiter_details.php?id=35"
18 ["Ernst Gunnar Gran"]="https://simula.no/people/ernstgr"
19 ["Erwin Paul Rathgeb"]="http://www.tdr.wiwi.uni-due.de/team/erwin-p-rathgeb/"
20 ["Fu Fa"]="http://cist.hainu.edu.cn/news/showteacherdetail.do?userId=44"
21 ["Hakim Adhari"]="http://www.tdr.wiwi.uni-due.de/team/hakim-adhari/"
22 ["Irene Rüngeler"]="https://www.fh-münster.de/fb2/personen/mitarbeiter/ruengeler/"
23 ["Janardhan R. Iyengar"]="http://www.fandm.edu/janardhan-iyengar"
24 ["Jobin Pulinthanath"]="http://www.tdr.wiwi.uni-due.de/team/ehemalige-mitarbeiter/jobin-pulinthanath/"
25 ["Johannes Formann"]="http://dc.informatik.uni-essen.de/Formann/all/"
26 ["Markus Packeiser"]="http://www.tdr.wiwi.uni-due.de/team/markus-packeiser/"
27 ["Martin Becke"]="http://www.familie-becke.de/"
28 ["Michael Striewe"]="http://paluno.uni-due.de/das-institut/team/wissenschaftliche-mitarbeiter/michael-striewe/"
29 ["Michael Tüxen"]="https://www.fh-muenster.de/fb2/personen/professoren/tuexen/"
30 ["Özgü Alay"]="http://simula.no/people/ozgu"
31 ["Paul D. Amer"]="http://www.eecis.udel.edu/~amer/"
32 ["Randall R. Stewart"]="http://people.freebsd.org/~rrs/"
33 ["Robin Seggelmann"]="http://www.robin-seggelmann.de/"
34 ["Sebastian Werner"]="http://www.tdr.wiwi.uni-due.de/team/sebastian-werner/"
35 ["Simone Ferlin-Oliveira"]="http://simula.no/people/ferlin"
36 ["Thomas Dreibholz"]="https://www.nntb.no/~dreibh"
37 ["Xing Zhou"]="http://cist.hainu.edu.cn/news/showteacherdetail.do?userId=66"
38 # [""]=""
39 )
40
41
42 url="${authorUrl[` echo "$author" | sed -e "s/ / /g"`]}"
43 if [ "$url" != "" ] ; then
44 echo -n "<a href=\"$url\">$authorText</a>"
45 else
46 echo >&2 "NOTE: No URL for author $author"
47 echo -n "$authorText"
48 fi
49
50
51 elif [ "$type" = "location" ] ; then
52 place="$2"
53 city=""
54 region=""
55 country=""
56 url=""
57
58 if [[ "$place" =~ ^([^,]*)(,[ \t])([^/]*)/(.*)$ ]] ; then # City, Region/Country
59 q=${BASH_REMATCH[0]}
60 city=${BASH_REMATCH[1]}
61 region=${BASH_REMATCH[3]}
62 country=${BASH_REMATCH[4]}
63 elif [[ "$place" =~ ^([^,]*)([,/][ \t]*)(.*)$ ]] ; then # City/Country
64 city=${BASH_REMATCH[1]}
65 region=""
66 country=${BASH_REMATCH[3]}
67 elif [[ "$place" =~ ^([^,/]*)$ ]] ; then # Country only (e.g. Singapore)
68 country=${BASH_REMATCH[1]}
69 else
70 echo >&2 "NOTE: Cannot interpret place $place"
71 fi
72
73
74 if [ "$country" != "" ] ; then
75 s=""
76 if [ "$city" != "" ] ; then
77 s="$city, "
78 fi
79 if [ "$region" != "" ] ; then
80 s="$s$region, "
81 fi
82 s="$s$country"
83 url="https://www.openstreetmap.org/search?query=$s"
84 fi
85
86
87 if [ "$url" != "" ] ; then
88 echo -n "<a href=\"$url\">$place</a>"
89 else
90 echo >&2 "NOTE: No URL for place $place"
91 echo -n "$place"
92 fi
93 fi