File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,31 @@ git --work-tree "$ROOT_DIR" worktree add -B gh-pages "$PAGES_DIR" origin/gh-page
3838# Now work in newly created workspace
3939cd " $PAGES_DIR "
4040
41- # Remove all the old documentation
42- git rm -r * > /dev/null
41+ # Fixup all the old documentation files
42+ # Remove non-.html files
43+ git rm ` find . -type f -not -name ' *.html' -not -name ' .git' ` > /dev/null
44+
45+ # Replace "experimental" .html files with links to the corresponding non-experimental version
46+ # or remove them if there is no corresponding non-experimental file
47+ echo " Redirecting experimental pages"
48+ git_add=()
49+ git_rm=()
50+ for file in ` find . -type f -name ' *.html' ` ; do
51+ match=nothing_is_found
52+ if [[ $file =~ \. experimental ]] ; then
53+ match=" ${file// \. experimental/ } "
54+ fi
55+ if [[ -f " $DIST_DIR /$match " ]] ; then
56+ # redirect to non-experimental version
57+ echo " <html><script>window.onload = function() { window.location.href = \" /kotlinx.coroutines${match# .} \" }</script></html>" > " $file "
58+ git_add+=(" $file " )
59+ else
60+ # redirect not found -- remove the file
61+ git_rm+=(" $file " )
62+ fi
63+ done
64+ git add " ${git_add[@]} "
65+ git rm " ${git_rm[@]} " > /dev/null
4366
4467# Copy new documentation from dist
4568cp -r " $DIST_DIR " /* " $PAGES_DIR "
You can’t perform that action at this time.
0 commit comments