-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.sh
118 lines (109 loc) · 2.66 KB
/
index.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/sh
cat << EOHEADER
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test plantuml-syntax</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="style.css" type="text/css" />
<style>
body {
background-color: #CCC;
font-size: 14pt;
font-family: arial, sans-serif;
}
figure {
margin-left: 1em;
flex: 1 0 0;
overflow: auto;
}
h1, h2 {
color: #AAA;
text-align: center;
}
h2 {
font-size: 140%;
margin: 1em 2em;
}
a {
text-decoration: none;
color: #58C;
}
li {
list-style-type: none;
}
.wrap {
display: flex;
min-height: 100dvh;
margin: 0 auto;
}
.two {
display: flex;
gap: 1em;
overflow: auto;
}
svg {
width: 240%;
height: 240%;
}
section {
margin: 1em;
padding: 1em;
flex: 1 0 0;
width: fit-content;
}
nav {
position: sticky;
top: 0;
height: 100dvh;
overflow-y: auto;
background-color: #CCC;
padding: 1em;
min-width: 30%;
max-width: 300px;
font-size: 16pt;
}
nav > ul {
position: relative;
top: 0;
}
EOHEADER
echo "/* Styles from vim */"
cat uml/*.css | sort -u
cat << "EOREST";
</style>
</head>
<body>
<h1>PlantUML syntax examples</h1>
<p>These are examples taken from the official documentation: https://plantuml.com/
Generated by <a href="https://github.com/aklt/plantuml-syntax-test">Plantuml syntax Test</a>.
</p>
EOREST
echo '<div class="wrap">'
echo "<nav><ul>"
for i in $(echo "$@" | tr ' ' '\n' | sort); do
baseName=$(echo "$i" | sed -e 's/^uml\///' -e 's/\.pre\.html$//')
titleName=$(echo "$baseName" | sed -e 's/^uml\///' -e 's/^reference_//' -e 's/_/ /g')
echo "<li><a href=\"#$baseName\">$titleName</a></li>"
done
echo "</ul></nav>"
echo "<main>"
for i in $(echo "$@" | tr ' ' '\n' | sort); do
baseName=$(echo "$i" | sed -e 's/\.pre\.html$//')
anchorName=$(echo "$baseName" | sed -e 's/^uml\///')
titleName=$(echo "$baseName" | sed -e 's/^uml\///' -e 's/^reference_//' -e 's/_/ /g')
echo "<a name=\"$anchorName\"></a><section>"
echo "<h2>$titleName</h2>"
echo '<div class="two">'
cat "$i" | sed -e "s/ id='vimCodeElement'//"
echo "<figure>"
cat "${baseName}.svg" | sed -e 's/^<?xml version="1.0" encoding="us-ascii" standalone="no"?>//'
echo "</figure>"
echo "</div></section>"
done
echo "</main>"
echo "</div>"
cat << EOFOOTER
</body>
</html>
EOFOOTER