fix: don't flatten docs
This commit is contained in:
@@ -25,8 +25,9 @@ jobs:
|
|||||||
pixi install --locked
|
pixi install --locked
|
||||||
pixi run doc-build
|
pixi run doc-build
|
||||||
|
|
||||||
- name: Flatten so the crate sits at the channel root
|
- name: Redirect the channel root to the crate page
|
||||||
run: bash scripts/flatten-docs.sh
|
run: |
|
||||||
|
printf '%s\n' "<!doctype html><meta http-equiv=\"refresh\" content=\"0; url=${CRATE}/\">" > target/doc/index.html
|
||||||
|
|
||||||
- name: Publish the channel to /srv/www
|
- name: Publish the channel to /srv/www
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<div style="padding:.4rem .75rem;font:0.85rem/1.4 sans-serif;border-bottom:1px solid var(--border-color,#ddd);background:var(--sidebar-background-color,#f7f7f7);color:var(--main-color,#000)">
|
<div id="cb-channel-switch" style="position:fixed;bottom:0.75rem;right:0.75rem;z-index:1000;padding:.3rem .6rem;font:0.8rem/1.3 sans-serif;border:1px solid var(--border-color,#ccc);border-radius:6px;background:var(--main-background-color,#fff);color:var(--main-color,#000);box-shadow:0 1px 4px rgba(0,0,0,.2)">
|
||||||
Docs channel:
|
<a id="ch-release" href="#" style="margin:0 .25rem">release</a>|
|
||||||
<a id="ch-release" href="#" style="margin:0 .35rem">release</a>|
|
<a id="ch-nightly" href="#" style="margin:0 .25rem">nightly</a>
|
||||||
<a id="ch-nightly" href="#" style="margin:0 .35rem">nightly</a>
|
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
var m = location.pathname.match(/^(.*\/)(release|nightly)\//);
|
var m = location.pathname.match(/^(.*\/)(release|nightly)\//);
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Flatten rustdoc output so the crate serves at the doc root rather than under
|
|
||||||
# <crate>/. Moves the crate's pages up to the doc root and drops one ../ from
|
|
||||||
# each page's references to the shared assets (CSS/JS, search index, source),
|
|
||||||
# scaled to the page's depth.
|
|
||||||
# Env: DOCROOT (default target/doc), CRATE (default coursebank).
|
|
||||||
set -euo pipefail
|
|
||||||
docroot="${DOCROOT:-target/doc}"
|
|
||||||
crate="${CRATE:-coursebank}"
|
|
||||||
[ -d "$docroot/$crate" ] || { echo "no $docroot/$crate; did you build the docs?" >&2; exit 1; }
|
|
||||||
cp -a "$docroot/$crate/." "$docroot/"
|
|
||||||
rm -rf "${docroot:?}/${crate:?}"
|
|
||||||
resources='static\.files/\|crates\.js\|search-index\|search\.desc/\|src/\|settings\.html\|help\.html\|trait\.impl/\|type\.impl/'
|
|
||||||
while IFS= read -r -d '' f; do
|
|
||||||
rel="${f#"$docroot"/}"
|
|
||||||
depth=$(printf '%s' "$rel" | tr -cd '/' | wc -c)
|
|
||||||
pat=''; for ((i=0; i<=depth; i++)); do pat="\\.\\./$pat"; done
|
|
||||||
rep=''; for ((i=0; i<depth; i++)); do rep="../$rep"; done
|
|
||||||
sed -i "s#${pat}\(${resources}\)#${rep}\1#g" "$f"
|
|
||||||
done < <(find "$docroot" -name '*.html' -print0)
|
|
||||||
echo "flattened $crate into $docroot"
|
|
||||||
@@ -1,8 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Point the site root at the latest release, falling back to nightly.
|
# Point the site root at the latest release, falling back to nightly.
|
||||||
# Env: WWW_ROOT (default /srv/www), SITE_SLUG (default coursebank).
|
# rustdoc serves the crate under <crate>/, so the target includes that segment.
|
||||||
|
# Env: WWW_ROOT (default /srv/www), SITE_SLUG (default coursebank),
|
||||||
|
# CRATE (default coursebank).
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
root="${WWW_ROOT:-/srv/www}/${SITE_SLUG:-coursebank}"
|
root="${WWW_ROOT:-/srv/www}/${SITE_SLUG:-coursebank}"
|
||||||
if [ -e "$root/release/index.html" ]; then target="release/"; else target="nightly/"; fi
|
crate="${CRATE:-coursebank}"
|
||||||
|
if [ -e "$root/release/$crate/index.html" ]; then
|
||||||
|
target="release/$crate/"
|
||||||
|
else
|
||||||
|
target="nightly/$crate/"
|
||||||
|
fi
|
||||||
printf '%s\n' "<!doctype html><meta http-equiv=\"refresh\" content=\"0; url=${target}\">" > "$root/index.html"
|
printf '%s\n' "<!doctype html><meta http-equiv=\"refresh\" content=\"0; url=${target}\">" > "$root/index.html"
|
||||||
echo "site root -> $target"
|
echo "site root -> $target"
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@
|
|||||||
//! ## The loop
|
//! ## The loop
|
||||||
//!
|
//!
|
||||||
//! ```text
|
//! ```text
|
||||||
//! author items ──▶ validate ──▶ lint ──▶ assemble ──▶ export ──┐
|
//! author items ──▶ validate ──▶ lint ──▶ assemble ──▶ export ───┐
|
||||||
//! ▲ │
|
//! ▲ │
|
||||||
//! │ administer
|
//! │ administer
|
||||||
//! │ │
|
//! │ │
|
||||||
|
|||||||
Reference in New Issue
Block a user