mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
Beautify example showcase site URLs (#12348)
# Objective The current example showcase site URLs have white-space and caps in them which looks ugly as an URL. Fixes https://github.com/bevyengine/bevy-website/issues/736 ## Solution To fix this the example showcase tool now makes the category used for the site sections lowercase, separated by a hyphen rather than white-space, and without parentheses. --------- Co-authored-by: Rob Parrett <robparrett@gmail.com> Co-authored-by: vero <email@atlasdostal.com>
This commit is contained in:
parent
36cfb2170f
commit
0820b7f326
1 changed files with 23 additions and 1 deletions
|
@ -464,7 +464,19 @@ header_message = \"Examples (WebGL2)\"
|
|||
if !to_show.wasm {
|
||||
continue;
|
||||
}
|
||||
let category_path = root_path.join(&to_show.category);
|
||||
|
||||
// This beautifys the path
|
||||
// to make it a good looking URL
|
||||
// rather than having weird whitespace
|
||||
// and other characters that don't
|
||||
// work well in a URL path.
|
||||
let category_path = root_path.join(
|
||||
&to_show
|
||||
.category
|
||||
.replace(['(', ')'], "")
|
||||
.replace(' ', "-")
|
||||
.to_lowercase(),
|
||||
);
|
||||
|
||||
if !categories.contains_key(&to_show.category) {
|
||||
let _ = fs::create_dir_all(&category_path);
|
||||
|
@ -500,6 +512,10 @@ title = \"{}\"
|
|||
template = \"example{}.html\"
|
||||
weight = {}
|
||||
description = \"{}\"
|
||||
# This creates redirection pages
|
||||
# for the old URLs which used
|
||||
# uppercase letters and whitespace.
|
||||
aliases = [\"/examples{}/{}/{}\"]
|
||||
|
||||
[extra]
|
||||
technical_name = \"{}\"
|
||||
|
@ -516,6 +532,12 @@ header_message = \"Examples ({})\"
|
|||
},
|
||||
categories.get(&to_show.category).unwrap(),
|
||||
to_show.description.replace('"', "'"),
|
||||
match api {
|
||||
WebApi::Webgpu => "-webgpu",
|
||||
WebApi::Webgl2 => "",
|
||||
},
|
||||
to_show.category,
|
||||
&to_show.technical_name.replace('_', "-"),
|
||||
&to_show.technical_name.replace('_', "-"),
|
||||
match api {
|
||||
WebApi::Webgpu => "-webgpu",
|
||||
|
|
Loading…
Reference in a new issue