-
Notifications
You must be signed in to change notification settings - Fork 11
/
preprocess-docsite.sh
executable file
·20 lines (16 loc) · 1.35 KB
/
preprocess-docsite.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash
# This script takes the output of the gradle 'apidocs' task and performs any further
# processing prior to publishing or packaging.
# Changes to the HTML documentation generated by Dokka.
# The default template shows a collapsable navigation pane. We don't have too many classes
# so we want to remove the ability to collapse and instead just show all the classes on
# the left. To do this we modify the scripts to never add the 'hidden' class to the
# menu items and we modify the html so clicks on menu items do not hide/restore them.
# You need to make sure the arrow_down.svg from docs/assets is also copied to the
# generated output. This is configured in the :dokkaHtml task in our root build.gradle.
# Modify the navigation script to never hide menu items.
sed -z -i 's/if (!nav\.classList\.contains("hidden"))/if (nav.classList.contains("hidden"))/g' docs/api/scripts/navigation-loader.js
sed -z -i 's/nav.classList.add("hidden\")/nav.classList.remove("hidden")/g' docs/api/scripts/navigation-loader.js
sed -z -i 's/if (part\.classList\.contains(\"hidden\")) {/part\.setAttribute(\"data-active\", \"\")\n part\.scrollIntoView()\n if (0) {/g' docs/api/scripts/navigation-loader.js
# Modify the navigation page so menus cannot be collapsed
sed -z -i 's/"hidden"/"hidden_x"/g' docs/api/navigation.html