-
Notifications
You must be signed in to change notification settings - Fork 164
/
Copy pathmake_html.sh
executable file
·92 lines (83 loc) · 2.12 KB
/
make_html.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
# Generates HTML to show a preview of all icons in a given folder
# Part of the Chicago95 project
icons=$(find|awk -F'/' '{print $3}'|sed 's/\.[^.]*$//'|sort|uniq)
dirs=$(find -mindepth 1 -type d|sort -V|grep -v 256)
size=$(wc -w <<< "$dirs")
cat << HERE
<!DOCTYPE html>
<html>
<head>
<style>
td {
border: 1px solid black;
padding: 10px;
text-align:center;
font-size: x-small;
vertical-align: bottom;
background: white;
}
table {
position: relative;
margin-left: auto;
margin-right: auto;
}
th {
background: #000080;
color: white;
position: sticky;
top: 0;
border: 1px solid black;
padding: 10px;
text-align:center;
}
body {
background: #008080;
font-family: Arial, Helvetica, Arial, sans-serif;
}
h1, h2 {
font-family: Arial, Helvetica, Arial, sans-serif;
color: white;
text-align:center;
font-weight: bold;
}
</style>
<title>Chicago 95 Icons: ${PWD##*/}</title>
<!-- Part of the Chicago95 project -->
</head>
<body><h1>Chicago95 Icons: ${PWD##*/}</h1>
<br><br>
<p style="color:white">Below is the list of all icons using in the <b>${PWD##*/}</b> section. Each icon is identified by its name. If the icon is a symlink to another icon it will be followed by the name of the link target.</p>
<br><br>
<table>
HERE
echo -e "\t<tr>"
for d in $dirs; do
echo -e "\t\t<th>${d##*/}</th>"
done
echo -e "\t</tr>"
for i in $icons; do
filename=$i
echo -e "\t<tr>"
for d in $dirs; do
echo -e "\t\t<td>"
if [ $d = "./scalable" ]; then
checkfile="$filename.svg"
img=$(echo "<img width=48px src=\"$d/$checkfile\" alt=\"$checkfile\"></img>")
else
checkfile="$filename.png"
img=$(echo "<img src=\"$d/$checkfile\" alt=\"$checkfile\"></img>")
fi
if [ -f "$d/$checkfile" ]; then
echo -e "\t\t\t$img"
echo -e "\t\t\t<br>$checkfile"
fi
if [ -L "$d/$checkfile" ]; then
realfile=$(readlink -f $d/$checkfile)
echo -e "\t\t\t<br>(<b>$(basename $realfile)</b>)"
fi
echo -e "\t\t</td>"
done
echo -e "\t</tr>"
done
echo -e "</table></body></html>"