Skip to content

Commit 1ab074a

Browse files
committed
can hide an example
1 parent 5353df3 commit 1ab074a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,7 @@ name = "hello_world"
127127
path = "examples/hello_world.rs"
128128

129129
[package.metadata.example.hello_world]
130-
name = "Hello World"
131-
description = "The basics"
132-
category = "Hello World"
133-
wasm = true
130+
hidden = true
134131

135132
# 2D Rendering
136133
[[example]]

tools/build-example-pages/src/main.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ fn parse_examples(panic_on_missing: bool) -> Vec<Example> {
7272
panic!("Missing metadata for example {}", technical_name);
7373
}
7474
}
75+
76+
if metadatas
77+
.get(&technical_name)
78+
.and_then(|metadata| metadata.get("hidden"))
79+
.and_then(|hidden| hidden.as_bool())
80+
.and_then(|hidden| hidden.then(|| ()))
81+
.is_some()
82+
{
83+
return None;
84+
}
85+
7586
metadatas.get(&technical_name).map(|metadata| Example {
7687
technical_name,
7788
path: val["path"].as_str().unwrap().to_string(),

0 commit comments

Comments
 (0)