Skip to content

Commit

Permalink
Add script to fix H1s on docs (#7835)
Browse files Browse the repository at this point in the history
* Add script to fix H1s on docs

Per SEO team request, the Javadoc generated docs need H1s.

* Update javadoc header-fix script

---------

Co-authored-by: Claus Rørbech <claus.rorbech@mongodb.com>
  • Loading branch information
cbush and rorbech authored Jul 25, 2023
1 parent 9860894 commit 37083aa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tools/fix-h1s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash -ex

usage() {
cat <<EOF
Usage: $0 <javadoc-root-dir>
EOF
}

if [ "$#" -ne 1 ] ; then
usage
exit 1
fi

# Assume Dokka has been run
pushd $1

find . -name "*.html" | while read ln
do
# Make the output SEO friendly by converting the "h2" title to the proper "h1"
sed -i -e 's|<h2\(.* class="title".*\)</h2>|<h1\1</h1>|' "$ln"
done
find . -iname "*.html-e" | xargs rm

popd
1 change: 1 addition & 0 deletions tools/publish_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ create_javadoc() {
echo "Creating JavaDoc..."
cd $REALM_JAVA_PATH
eval "./gradlew javadoc $GRADLE_BUILD_PARAMS --stacktrace"
eval "./tools/fix-h1s.sh realm/realm-library/build/docs/javadoc/"
cd $HERE
}

Expand Down

0 comments on commit 37083aa

Please sign in to comment.