forked from Neoteroi/BlackSheep-Docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixlinks.sh
executable file
·55 lines (50 loc) · 2.36 KB
/
fixlinks.sh
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
echo "Fixing links..."
if [ -n "$VERSION" ]; then
VERSION="/$VERSION"
fi
for i in ./site/*.html
do
echo "Fixing $i"
sed -i -E 's,href="\.\.?",href="/blacksheep'$VERSION'/",' $i
sed -i -E 's,base: ".",base: "/blacksheep'$VERSION'/",' $i
sed -i -E 's,worker: "assets/,worker: "/blacksheep'$VERSION'/assets/,' $i
sed -i -E 's,src="\.\/([a-z]+),src="/blacksheep'$VERSION'/\1,' $i
sed -i -E 's,href="\.\/([a-z]+),href="/blacksheep'$VERSION'/\1,' $i
sed -i -E 's,src="([a-z]+),src="/blacksheep'$VERSION'/\1,' $i
sed -i -E 's,href="([a-z]+),href="/blacksheep'$VERSION'/\1,' $i
sed -i -E 's,src="([a-z]+),src="/blacksheep'$VERSION'/\1,' $i
sed -i -E 's,src="img/,src="/blacksheep'$VERSION'/img/,' $i
sed -i -E 's,src="../,src="/blacksheep'$VERSION'/,' $i
sed -i -E 's,href="../,href="/blacksheep'$VERSION'/,' $i
sed -i -E 's,href="css/,href="/blacksheep'$VERSION'/css/,' $i
sed -i -E 's,href="img/,href="/blacksheep'$VERSION'/img/,' $i
sed -i -E 's,href="assets/,href="/blacksheep'$VERSION'/assets/,' $i
sed -i -E 's,/blacksheep'$VERSION'/https://,https://,' $i
sed -i -E 's,src="/img,src="/blacksheep'$VERSION'/img,' $i
done
for i in ./site/**/*.html
do
echo "Fixing $i"
sed -i -E 's,href="\.\.?",href="/blacksheep'$VERSION'/",' $i
sed -i -E 's,base: "\.\.",base: "/blacksheep'$VERSION'/",' $i
sed -i -E 's,worker: "\.\./assets/,worker: "/blacksheep'$VERSION'/assets/,' $i
sed -i -E 's,src="\.\/([a-z]+),src="/blacksheep'$VERSION'/\1,' $i
sed -i -E 's,href="\.\/([a-z]+),href="/blacksheep'$VERSION'/\1,' $i
sed -i -E 's,src="([a-z]+),src="/blacksheep'$VERSION'/\1,' $i
sed -i -E 's,href="([a-z]+),href="/blacksheep'$VERSION'/\1,' $i
sed -i -E 's,src="([a-z]+),src="/blacksheep'$VERSION'/\1,' $i
sed -i -E 's,src="img/,src="/blacksheep'$VERSION'/img/,' $i
sed -i -E 's,src="../,src="/blacksheep'$VERSION'/,' $i
sed -i -E 's,href="../,href="/blacksheep'$VERSION'/,' $i
sed -i -E 's,href="css/,href="/blacksheep'$VERSION'/css/,' $i
sed -i -E 's,href="img/,href="/blacksheep'$VERSION'/img/,' $i
sed -i -E 's,href="assets/,href="/blacksheep'$VERSION'/assets/,' $i
sed -i -E 's,src="/img,src="/blacksheep'$VERSION'/img,' $i
sed -i -E 's,/blacksheep'$VERSION'/https://,https://,' $i
done
for i in ./site/**/*.html
do
echo "Fixing $i"
sed -i -E 's,/blacksheep'$VERSION'/https://,https://,' $i
sed -i -E 's,/blacksheep'$VERSION'/http://,http://,' $i
done