Skip to content

Commit

Permalink
Merge pull request #46 from lukewilliamboswell/docs-0.12.0
Browse files Browse the repository at this point in the history
fix base href, add script to help
  • Loading branch information
lukewilliamboswell authored Jan 23, 2025
2 parents ae1de30 + 1df6860 commit 61028d6
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 8 deletions.
33 changes: 33 additions & 0 deletions docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
set -euxo pipefail

# Function to validate version number format (x.y.z)
validate_version() {
if [[ ! $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Version number must be in format x.y.z (e.g., 0.12.0)"
exit 1
fi
}

# Check if version argument is provided
if [ $# -ne 1 ]; then
echo "Usage: $0 <version>"
echo "Example: $0 0.12.0"
exit 1
fi

VERSION=$1

# Validate version number
validate_version "$VERSION"

# Run roc docs with validated version
roc docs --root-dir "/roc-json/$VERSION/" package/main.roc

# Create new version directory in www/
mkdir www/$VERSION

# Move generated docs to version directory
mv generated-docs/* www/$VERSION
4 changes: 2 additions & 2 deletions www/0.12.0/Json/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>Json - Documentation</title>
<!-- <meta name="description" content="TODO populate this based on the module's description"> -->
<meta name="viewport" content="width=device-width" />
<base href="/" />
<base href="/roc-json/0.12.0/" />
<script type="text/javascript" src="search.js" defer></script>
<link rel="stylesheet" href="styles.css" />
<link rel="icon" href="/favicon.svg" />
Expand All @@ -30,7 +30,7 @@
points="0,0 23.8834,3.21052 37.2438,19.0101 45.9665,16.6324 50.5,22 45,22 44.0315,26.3689 26.4673,39.3424 27.4527,45.2132 17.655,53 23.6751,22.7086" />
</svg>
</a>
<h1 class="pkg-full-name" ><a href="/" >Documentation</a></h1>
<h1 class="pkg-full-name" ><a href="/roc-json/0.12.0/" >Documentation</a></h1>
<button class="menu-toggle" aria-label="Toggle sidebar">
<svg viewBox="0 0 72 72" id="emoji" xmlns="http://www.w3.org/2000/svg" fill="currentcolor">
<g id="SVGRepo_iconCarrier">
Expand Down
4 changes: 2 additions & 2 deletions www/0.12.0/Option/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>Option - Documentation</title>
<!-- <meta name="description" content="TODO populate this based on the module's description"> -->
<meta name="viewport" content="width=device-width" />
<base href="/" />
<base href="/roc-json/0.12.0/" />
<script type="text/javascript" src="search.js" defer></script>
<link rel="stylesheet" href="styles.css" />
<link rel="icon" href="/favicon.svg" />
Expand All @@ -30,7 +30,7 @@
points="0,0 23.8834,3.21052 37.2438,19.0101 45.9665,16.6324 50.5,22 45,22 44.0315,26.3689 26.4673,39.3424 27.4527,45.2132 17.655,53 23.6751,22.7086" />
</svg>
</a>
<h1 class="pkg-full-name" ><a href="/" >Documentation</a></h1>
<h1 class="pkg-full-name" ><a href="/roc-json/0.12.0/" >Documentation</a></h1>
<button class="menu-toggle" aria-label="Toggle sidebar">
<svg viewBox="0 0 72 72" id="emoji" xmlns="http://www.w3.org/2000/svg" fill="currentcolor">
<g id="SVGRepo_iconCarrier">
Expand Down
4 changes: 2 additions & 2 deletions www/0.12.0/OptionOrNull/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>OptionOrNull - Documentation</title>
<!-- <meta name="description" content="TODO populate this based on the module's description"> -->
<meta name="viewport" content="width=device-width" />
<base href="/" />
<base href="/roc-json/0.12.0/" />
<script type="text/javascript" src="search.js" defer></script>
<link rel="stylesheet" href="styles.css" />
<link rel="icon" href="/favicon.svg" />
Expand All @@ -30,7 +30,7 @@
points="0,0 23.8834,3.21052 37.2438,19.0101 45.9665,16.6324 50.5,22 45,22 44.0315,26.3689 26.4673,39.3424 27.4527,45.2132 17.655,53 23.6751,22.7086" />
</svg>
</a>
<h1 class="pkg-full-name" ><a href="/" >Documentation</a></h1>
<h1 class="pkg-full-name" ><a href="/roc-json/0.12.0/" >Documentation</a></h1>
<button class="menu-toggle" aria-label="Toggle sidebar">
<svg viewBox="0 0 72 72" id="emoji" xmlns="http://www.w3.org/2000/svg" fill="currentcolor">
<g id="SVGRepo_iconCarrier">
Expand Down
4 changes: 2 additions & 2 deletions www/0.12.0/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title> - Documentation</title>
<!-- <meta name="description" content="TODO populate this based on the module's description"> -->
<meta name="viewport" content="width=device-width" />
<base href="/" />
<base href="/roc-json/0.12.0/" />
<script type="text/javascript" src="search.js" defer></script>
<link rel="stylesheet" href="styles.css" />
<link rel="icon" href="/favicon.svg" />
Expand All @@ -30,7 +30,7 @@
points="0,0 23.8834,3.21052 37.2438,19.0101 45.9665,16.6324 50.5,22 45,22 44.0315,26.3689 26.4673,39.3424 27.4527,45.2132 17.655,53 23.6751,22.7086" />
</svg>
</a>
<h1 class="pkg-full-name" ><a href="/" >Documentation</a></h1>
<h1 class="pkg-full-name" ><a href="/roc-json/0.12.0/" >Documentation</a></h1>
<button class="menu-toggle" aria-label="Toggle sidebar">
<svg viewBox="0 0 72 72" id="emoji" xmlns="http://www.w3.org/2000/svg" fill="currentcolor">
<g id="SVGRepo_iconCarrier">
Expand Down

0 comments on commit 61028d6

Please sign in to comment.