()
| 35 | level: u8, |
| 36 | text: String, |
| 37 | id: String, |
| 38 | } |
| 39 | |
| 40 | fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 41 | println!("cargo:rerun-if-changed=../docs"); |
| 42 | println!("cargo:rerun-if-changed=../perro_book"); |
| 43 | println!("cargo:rerun-if-changed=../README.md"); |
| 44 | |
| 45 | let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?); |
| 46 | let root = manifest_dir |
| 47 | .parent() |
| 48 | .ok_or("website manifest must have workspace parent")? |
| 49 | .to_path_buf(); |
| 50 | build_and_sync_demo(&root, "Demo2D", "demo2d")?; |
| 51 | build_and_sync_demo(&root, "Demo3D", "demo3d")?; |
| 52 | |
| 53 | let mut docs = Vec::new(); |
| 54 | |
| 55 | collect_markdown("docs", &root.join("docs"), &root.join("docs"), &mut docs)?; |
| 56 | collect_markdown( |
| 57 | "book", |
| 58 | &root.join("perro_book"), |
| 59 | &root.join("perro_book"), |
| 60 | &mut docs, |
| 61 | )?; |
| 62 | collect_demo_docs( |
| 63 | "examples/demo2d", |
| 64 | &root.join("demos/Demo2D/docs"), |
| 65 | &mut docs, |
| 66 | )?; |
| 67 | collect_demo_docs( |
| 68 | "examples/demo3d", |
| 69 | &root.join("demos/Demo3D/docs"), |
| 70 | &mut docs, |
| 71 | )?; |
| 72 | |
| 73 | docs.sort_by(|a, b| a.slug.cmp(&b.slug)); |
| 74 | let mut nav_counts = std::collections::BTreeMap::<String, u16>::new(); |
| 75 | for doc in &mut docs { |
| 76 | let order = nav_counts.entry(doc.nav_group.clone()).or_default(); |
| 77 | doc.nav_order = *order; |
| 78 | *order = order.saturating_add(1); |
nothing calls this directly
no test coverage detected