Skip to content

Commit dc8708a

Browse files
committed
Scala3doc: hack generating an index file
1 parent b4d7084 commit dc8708a

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

.github/workflows/scala3doc.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ jobs:
5757
- name: Generate documentation for example project using dotty-sbt
5858
run: ./project/scripts/sbt "sbt-dotty/scripted sbt-dotty/scala3doc"
5959

60+
- name: Generate index file
61+
run: scala3doc/scripts/mk-index.sh scala3doc/output > scala3doc/output/index.html
62+
6063
- name: Upload documentation to server
6164
uses: azure/CLI@v1
6265
env:

scala3doc/scripts/mk-index.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
3+
function print-beginning {
4+
cat << 'EOF'
5+
<html>
6+
<body>
7+
<p> Available projects: </p>
8+
<ul>
9+
EOF
10+
}
11+
12+
function print-list-element {
13+
cat << EOF
14+
<li> <a href="$1">$2</a> </li>
15+
EOF
16+
}
17+
18+
function print-ending {
19+
cat << 'EOF'
20+
</ul>
21+
</body>
22+
</html>
23+
EOF
24+
}
25+
26+
cd "$1" || exit
27+
28+
print-beginning
29+
for f in *
30+
do
31+
! [[ -d $f ]] && continue
32+
# assuming that there's only one "root" index file
33+
# if there's a static site, it's at depth 1
34+
# otherwise at depth 2
35+
INDEX=$(find "$f" -maxdepth 1 -name 'index.html')
36+
if [[ -z $INDEX ]]
37+
then
38+
INDEX=$(find "$f" -maxdepth 2 -name 'index.html')
39+
fi
40+
print-list-element "$INDEX" "$f"
41+
done
42+
print-ending

0 commit comments

Comments
 (0)