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
					
				| @ -464,7 +464,19 @@ header_message = \"Examples (WebGL2)\" | |||||||
|                 if !to_show.wasm { |                 if !to_show.wasm { | ||||||
|                     continue; |                     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) { |                 if !categories.contains_key(&to_show.category) { | ||||||
|                     let _ = fs::create_dir_all(&category_path); |                     let _ = fs::create_dir_all(&category_path); | ||||||
| @ -500,6 +512,10 @@ title = \"{}\" | |||||||
| template = \"example{}.html\" | template = \"example{}.html\" | ||||||
| weight = {} | weight = {} | ||||||
| description = \"{}\" | description = \"{}\" | ||||||
|  | # This creates redirection pages | ||||||
|  | # for the old URLs which used | ||||||
|  | # uppercase letters and whitespace. | ||||||
|  | aliases = [\"/examples{}/{}/{}\"]
 | ||||||
| 
 | 
 | ||||||
| [extra] | [extra] | ||||||
| technical_name = \"{}\" | technical_name = \"{}\" | ||||||
| @ -516,6 +532,12 @@ header_message = \"Examples ({})\" | |||||||
|                             }, |                             }, | ||||||
|                             categories.get(&to_show.category).unwrap(), |                             categories.get(&to_show.category).unwrap(), | ||||||
|                             to_show.description.replace('"', "'"), |                             to_show.description.replace('"', "'"), | ||||||
|  |                             match api { | ||||||
|  |                                 WebApi::Webgpu => "-webgpu", | ||||||
|  |                                 WebApi::Webgl2 => "", | ||||||
|  |                             }, | ||||||
|  |                             to_show.category, | ||||||
|  |                             &to_show.technical_name.replace('_', "-"), | ||||||
|                             &to_show.technical_name.replace('_', "-"), |                             &to_show.technical_name.replace('_', "-"), | ||||||
|                             match api { |                             match api { | ||||||
|                                 WebApi::Webgpu => "-webgpu", |                                 WebApi::Webgpu => "-webgpu", | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 TrialDragon
						TrialDragon