-
Notifications
You must be signed in to change notification settings - Fork 16
added script and html for Documenter Navigation #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e72fb62
added script and html for Documenter Navigation
shravanngoswamii 7d7f89b
fixed NAVBAR URL
shravanngoswamii d1da755
Update assets/scripts/insert_navbar.sh
yebai b087373
Create README.md
yebai 8eacc92
removed extra line
shravanngoswamii 5d57545
Update assets/scripts/navbar.html
shravanngoswamii 90db7d8
Update README.md
yebai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This `scripts` folder contains utilities for building Turing language satellite packages' documentation. | ||
|
||
- `insert_navbar.sh`: This function inserts a MultiDocumenter-style top navigation bar to `Documenter.jl` generated sites. | ||
- `navbar.html`: the content of the top navigation bar inserted by `insert_navbar.sh`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
# This script inserts a top navigation bar (e.g., `navbar.html`) into Documenter.jl generated sites. | ||
# The resulting output is similar to MultiDocumenter's navigation menu. The navigation menu is | ||
# hard-coded at the moment, which could be improved in the future. | ||
|
||
# URL of the navigation bar HTML file | ||
NAVBAR_URL="https://raw.githubusercontent.com/TuringLang/turinglang.github.io/main/assets/scripts/navbar.html" | ||
|
||
# Directory containing HTML files (passed as the first argument to the script) | ||
HTML_DIR=$1 | ||
|
||
# Download the navigation bar HTML content | ||
NAVBAR_HTML=$(curl -s $NAVBAR_URL) | ||
|
||
# Check if the download was successful | ||
if [ -z "$NAVBAR_HTML" ]; then | ||
echo "Failed to download navbar HTML" | ||
exit 1 | ||
fi | ||
|
||
# Process each HTML file in the directory | ||
for file in $(find $HTML_DIR -name "*.html"); do | ||
# Read the contents of the HTML file | ||
file_contents=$(cat "$file") | ||
|
||
# Insert the navbar HTML after the <body> tag | ||
updated_contents="${file_contents/$'<body>'/$'<body>\n'$NAVBAR_HTML}" | ||
shravanngoswamii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Write the updated contents back to the file | ||
echo "$updated_contents" > "$file" | ||
echo "Updated $file" | ||
done |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.