summaryrefslogtreecommitdiffstats
path: root/scripts/update-prism.sh
blob: 78be0de4f88544f93c3b8099eeb0598fad6c864a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

set -eu

URL_BASE='https://github.com/PrismJS/prism/raw/gh-pages'
RES_PATH='data/resources/prism'

download_files()
{
	local file=

	for file in "${@}"; do
		file="${file#%reldir%/}"
		mkdir -p "$(dirname "${0}")/../${RES_PATH}/${file%/*}"
		wget -O "$(dirname "${0}")/../${RES_PATH}/${file}" \
			"${URL_BASE}/${file%in}"
	done
}

while read line; do
	case "${line}" in
		*'_sources = '*)
			download_files ${line#*_sources = }
			;;
	esac
done <"$(dirname "${0}")/../data/resources/prism/local.mk"