Move dev docs#1366
Conversation
|
I am aware that the link checker tests are failing. They will continue to fail until this branch is merged because there are absolute urls that will not exist until after this version of the docs is deployed. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1366 +/- ##
=======================================
Coverage 89.60% 89.60%
=======================================
Files 58 58
Lines 8338 8338
Branches 8338 8338
=======================================
Hits 7471 7471
Misses 550 550
Partials 317 317 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
I'm having some trouble getting this to work locally. Quite possibly a me issue but thought I'd check. Snippets from output of Building book
INFO Book building has started
INFO Running the html backend
INFO HTML book written to `/home/dc2917/Documents/MUSE2/book`
Generating API documentation
Documenting muse2 v2.1.0 (/home/dc2917/Documents/MUSE2)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.47s
Generated /home/dc2917/Documents/MUSE2/target/doc/muse2/index.html
Moving dev docs to /devAll seems fine, content is in Building docs for v2.1.0
Building book
INFO Book building has started
INFO Running the html backend
INFO HTML book written to `/tmp/tmpa811vp7s/v2.1.0/book`
Generating API documentation
Compiling muse2 v2.1.0 (/tmp/tmpa811vp7s/v2.1.0)
Documenting muse2 v2.1.0 (/tmp/tmpa811vp7s/v2.1.0)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.28s
Generated /tmp/tmpa811vp7s/v2.1.0/target/doc/muse2/index.html
Copying to /home/dc2917/Documents/MUSE2/book/v2.1.0But I have no Building docs for v2.0.0
Building book
INFO Book building has started
INFO Running the html backend
INFO HTML book written to `/tmp/tmpa811vp7s/v2.0.0/book`
Generating API documentation
Compiling highs-sys v1.11.0
Compiling muse2 v2.0.0 (/tmp/tmpa811vp7s/v2.0.0)
Checking highs v1.12.0
Documenting muse2 v2.0.0 (/tmp/tmpa811vp7s/v2.0.0)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 2.62s
Generated /tmp/tmpa811vp7s/v2.0.0/target/doc/muse2/index.html
Copying to /home/dc2917/Documents/MUSE2/book/v2.0.0Nor do I have no I'm therefore getting 404 errors at http://localhost:3000/dev/index.html, http://localhost:3000/v2.1.0/index.html and http://localhost:3000/v2.0.0/index.html Edit: as discussed in mid-sprint, it's |
alexdewar
left a comment
There was a problem hiding this comment.
I think this is the right approach. A definite improvement!
I've left a few small suggestions and comments.
There was a problem hiding this comment.
Given that we now exclude the docs folder from the link checker, these could all be changed to relative links.
There was a problem hiding this comment.
These were kept as absolute links in #1344 because the links might break in future versions of the documentation, so it made sense to keep these link to the version of the docs that these release notes are referring to.
| var list = document.getElementById("version-list"); | ||
| var versionMatch = /\/release\/(v[\d.]+)\//.exec(path); | ||
| var versionMatch = /\/(v[\d.]+)\//.exec(path); |
There was a problem hiding this comment.
This regex doesn't quite make sense to me. I think the [\d.]+ means "a digit or any character (.) repeated at least one times". Could be that JavaScript's syntax is different to what I'm used to.
There was a problem hiding this comment.
Honestly, I don't understand regex, and this was co-pilot. I believe it's looking for a version string like "v2.1.0" so I interpreted the \d to mean an integer and the . to mean a decimal point. It does work like that, so I was inclined to trust it.
|
PS -- I realised there are some other places in the repo (e.g. under Obvs if anyone has any of the old pages bookmarked, those old URLs won't work anymore, which I think is fine. |
|
I'm looking into addressing some of these comments... But I've found an annoying issue with the 404 pages not rendering properly in deployment. For example https://energysystemsmodellinglab.github.io/MUSE2/bad.html |
Co-authored-by: @alexdewar
4311bff to
6776de3
Compare
There was a problem hiding this comment.
Pull request overview
This PR reorganises the documentation output layout so the current (development) docs live at /dev/ alongside versioned release docs at /vX.Y.Z/, and updates in-repo references accordingly. It also adds a root index.html redirect to send users to the most recent stable docs.
Changes:
- Update CLI help text + tests to point to
/v{CARGO_PKG_VERSION}/instead of/release/v{…}/. - Update the docs version widget to detect
/vX.Y.Z/paths and treat everything else asdev. - Add a script + Just recipes to move the built dev docs under
book/dev/and generate old-version docs as siblings inbook/.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/cli.rs | Updates help output assertion for the new versioned docs URL layout. |
| src/cli.rs | Updates CLI after_help docs URL to match the new layout. |
| docs/templates/header.hbs.jinja | Adjusts version detection + labels for the new /dev/ + /vX.Y.Z/ structure. |
| docs/release_notes/v2.1.0.md | Updates absolute release-note links to match the new docs paths. |
| docs/move_dev_docs.py | New script intended to move book/ into book/dev/ and create a stable redirect. |
| docs/build_old_docs.py | Writes old-version docs directly into book/vX.Y.Z/ instead of book/release/vX.Y.Z/. |
| build-docs.just | Adds move-dev step and rewires old docs build to use it. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| bookdir = REPO_ROOT / "book" | ||
| outdir = REPO_ROOT / "book" / "dev" | ||
|
|
||
| with TemporaryDirectory() as tmpdir: | ||
| # Move book to temporary directory | ||
| shutil.move(bookdir, tmpdir) | ||
| shutil.move(Path(tmpdir) / "book", outdir) | ||
|
|
There was a problem hiding this comment.
This sounds correct... but the code works as is, so I'm not inclined to change it
| # Redirect to stable (most recent) version of docs | ||
| with (bookdir / "index.html").open("w", encoding="utf-8") as f: | ||
| f.write(f"""<head> | ||
| <meta | ||
| http-equiv="Refresh" | ||
| content="0; URL=./{get_releases()[0]}/index.html" | ||
| /> | ||
| </head>""") |
There was a problem hiding this comment.
This is an edge-case that I don't think we need to worry about
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
I've addressed this, but instead of linking to the dev version, it will now link to the corresponding version of the docs. |
Description
This PR moves the development documentation so that is no longer the top-level documentation but is instead alongside the other releases.
There are no longer any top-level docs at all, instead, there is a redirect that takes the user to the most recent (stable) version of the docs when using the link in the readme (https://energysystemsmodellinglab.github.io/MUSE2/).
I have also removed the extra
releaselayer in the url path because it is no longer necessary given the top level docs don't exist at all. So the development docs will now live at https://energysystemsmodellinglab.github.io/MUSE2/dev/ (and replacedevwith any version string for other versions)Fixes #1193
Fixes #1194
Note: Requires #1356 to be merged first
Type of change
Key checklist
$ cargo test$ cargo docpresent in the previous release
Further checks