Skip to content

Commit 286037c

Browse files
committed
refactor(docs): link the edition registry from the landing page statically
Replace the generated per-edition link list on docs/index.md with a static sentence pointing at the generated registry index, and drop the now-unused marker-splicing machinery from the generator: it only writes docs/specs/editions/ now. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XKRaAHmFNvb7JoKTJVW8Pw Signed-off-by: Claude <noreply@anthropic.com>
1 parent 5879bf1 commit 286037c

3 files changed

Lines changed: 11 additions & 89 deletions

File tree

docs/index.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,8 @@ internals. Build and benchmark locally.
9494
## Editions
9595

9696
Vortex writers target **[editions](specs/editions.md)** — named, frozen sets of encodings that
97-
carry a forever read-compatibility guarantee:
98-
99-
<!-- BEGIN generated edition links: edit the declarations in `vortex/src/editions/` and run `cargo xtask generate-editions-docs` -->
100-
101-
- **core**: [`core2025.05.0`](specs/editions/core2025.05.0.md) · [`core2025.06.0`](specs/editions/core2025.06.0.md) · [`core2025.10.0`](specs/editions/core2025.10.0.md) · [`core2026.07.0`](specs/editions/core2026.07.0.md)
102-
- **unstable**: [`unstable2025.05.0`](specs/editions/unstable2025.05.0.md) · [`unstable2026.02.0`](specs/editions/unstable2026.02.0.md) · [`unstable2026.04.0`](specs/editions/unstable2026.04.0.md) · [`unstable2026.06.0`](specs/editions/unstable2026.06.0.md)
103-
104-
<!-- END generated edition links -->
97+
carry a forever read-compatibility guarantee. See every edition in the
98+
[edition registry](specs/editions/index.md).
10599

106100
```{toctree}
107101
---

xtask/README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,13 @@ be run every time changes are made to one of the .fbs files, or if any are added
2222
### `generate-editions-docs`
2323

2424
This regenerates the edition registry pages under `docs/specs/editions/` — an `index.md`
25-
listing every edition plus one page per edition — and the per-edition links on the docs
26-
landing page (`docs/index.md`) from the edition declarations in `vortex/src/editions/`.
27-
It first dumps the declarations as a TOML manifest to `target/editions-manifest.toml`
28-
(a build artifact, never committed) by running the `editions_manifest` example of the
29-
`vortex` crate, then renders that manifest into the registry pages (replacing the whole
30-
directory) and into the markdown between the `BEGIN`/`END generated edition links`
31-
markers on the landing page. The static spec, `docs/specs/editions.md`, links to the
32-
generated registry. Run it every time an edition declaration changes; CI fails if the
33-
committed registry is stale.
25+
listing every edition plus one page per edition — from the edition declarations in
26+
`vortex/src/editions/`. It first dumps the declarations as a TOML manifest to
27+
`target/editions-manifest.toml` (a build artifact, never committed) by running the
28+
`editions_manifest` example of the `vortex` crate, then renders that manifest into the
29+
registry pages, replacing the whole directory. The static pages (`docs/specs/editions.md`
30+
and the docs landing page) link to the generated registry. Run it every time an edition
31+
declaration changes; CI fails if the committed registry is stale.
3432

3533

3634

xtask/src/generate_editions_docs.rs

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,13 @@
44
use std::collections::BTreeMap;
55
use std::fmt::Write as _;
66
use std::fs;
7-
use std::path::Path;
87
use std::path::PathBuf;
98

109
use anyhow::Context;
11-
use anyhow::bail;
1210
use serde::Deserialize;
1311
use xshell::Shell;
1412
use xshell::cmd;
1513

16-
/// Marker lines delimiting the generated edition links on the docs landing page.
17-
/// Everything between them is owned by this generator; hand edits there are overwritten.
18-
static INDEX_BEGIN_MARKER: &str = "<!-- BEGIN generated edition links: edit the declarations in \
19-
`vortex/src/editions/` and run `cargo xtask generate-editions-docs` -->";
20-
static INDEX_END_MARKER: &str = "<!-- END generated edition links -->";
21-
2214
/// Header comment stamped on every fully generated page.
2315
static GENERATED_HEADER: &str = "<!-- Generated by `cargo xtask generate-editions-docs` from the \
2416
declarations in `vortex/src/editions/`; do not edit. -->";
@@ -62,16 +54,11 @@ impl ManifestEdition {
6254
fn sibling_link(&self) -> String {
6355
format!("[`{}`]({})", self.id, self.file_name())
6456
}
65-
66-
/// A link to this edition's page from `docs/index.md`.
67-
fn landing_link(&self) -> String {
68-
format!("[`{}`](specs/editions/{})", self.id, self.file_name())
69-
}
7057
}
7158

7259
/// Regenerate the edition registry pages under `docs/specs/editions/` (an index page plus
73-
/// one page per edition) and the edition links on `docs/index.md`, from the edition
74-
/// declarations in the `vortex` crate, via a TOML manifest written under `target/`.
60+
/// one page per edition) from the edition declarations in the `vortex` crate, via a TOML
61+
/// manifest written under `target/`.
7562
pub fn generate_editions_docs(profile: Option<String>) -> anyhow::Result<()> {
7663
let sh = Shell::new()?;
7764
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("..");
@@ -125,40 +112,6 @@ pub fn generate_editions_docs(profile: Option<String>) -> anyhow::Result<()> {
125112
registry_dir.display()
126113
);
127114

128-
splice(
129-
&root.join("docs/index.md"),
130-
INDEX_BEGIN_MARKER,
131-
INDEX_END_MARKER,
132-
&render_landing_links(&manifest)?,
133-
)?;
134-
Ok(())
135-
}
136-
137-
/// Replace the content between the marker comments in `path` with `content`.
138-
fn splice(path: &Path, begin_marker: &str, end_marker: &str, content: &str) -> anyhow::Result<()> {
139-
let text = fs::read_to_string(path)?;
140-
let (Some(begin), Some(end)) = (text.find(begin_marker), text.find(end_marker)) else {
141-
bail!(
142-
"{} must contain the generated-section BEGIN/END marker comments",
143-
path.display()
144-
);
145-
};
146-
if end < begin {
147-
bail!(
148-
"generated-section markers are out of order in {}",
149-
path.display()
150-
);
151-
}
152-
153-
let mut spliced = String::new();
154-
spliced.push_str(&text[..begin + begin_marker.len()]);
155-
spliced.push_str("\n\n");
156-
spliced.push_str(content);
157-
spliced.push('\n');
158-
spliced.push_str(&text[end..]);
159-
fs::write(path, spliced)?;
160-
161-
println!("regenerated the edition links in {}", path.display());
162115
Ok(())
163116
}
164117

@@ -277,26 +230,3 @@ fn render_edition(
277230
}
278231
Ok(md)
279232
}
280-
281-
/// Render the per-family edition links that go between the markers in `docs/index.md`.
282-
fn render_landing_links(manifest: &Manifest) -> anyhow::Result<String> {
283-
let mut md = String::new();
284-
// Editions arrive sorted by family, so consecutive dedup yields each family once.
285-
let mut families: Vec<&str> = manifest
286-
.editions
287-
.iter()
288-
.map(|edition| edition.family.as_str())
289-
.collect();
290-
families.dedup();
291-
292-
for family in families {
293-
let links: Vec<String> = manifest
294-
.editions
295-
.iter()
296-
.filter(|edition| edition.family == family)
297-
.map(ManifestEdition::landing_link)
298-
.collect();
299-
writeln!(md, "- **{family}**: {}", links.join(" · "))?;
300-
}
301-
Ok(md)
302-
}

0 commit comments

Comments
 (0)