Writes a valid docs section to contain the error pages in. The output path passed should be the folder you want the Zola pages to be written / output.
(output_path: &Path)
| 119 | /// The output path passed should be the folder |
| 120 | /// you want the Zola pages to be written / output. |
| 121 | pub fn write_section(output_path: &Path) -> anyhow::Result<()> { |
| 122 | let errors_folder_path = output_path.join("errors"); |
| 123 | // Make sure the output folder exists |
| 124 | fs::create_dir_all(&errors_folder_path)?; |
| 125 | |
| 126 | const SECTION_CONTENT: &str = r#"+++ |
| 127 | title = "Errors" |
| 128 | template = "docs.html" |
| 129 | page_template = "docs.html" |
| 130 | redirect_to = "/learn/errors/introduction" |
| 131 | +++ |
| 132 | "#; |
| 133 | |
| 134 | const INTRODUCTION_CONTENT: &str = r#"+++ |
| 135 | title = "Introduction" |
| 136 | [extra] |
| 137 | weight = 0 |
| 138 | +++ |
| 139 | |
| 140 | These pages document Bevy's error codes for the _current release_. |
| 141 | |
| 142 | In case you are looking for the latest error codes from Bevy's main branch, you can find them in the [Bevy engine repository](<https://github.com/bevyengine/bevy/tree/main/errors>). |
| 143 | "#; |
| 144 | |
| 145 | fs::write(errors_folder_path.join("_index.md"), SECTION_CONTENT)?; |
| 146 | fs::write( |
| 147 | errors_folder_path.join("introduction.md"), |
| 148 | INTRODUCTION_CONTENT, |
| 149 | )?; |
| 150 | |
| 151 | Ok(()) |
| 152 | } |
| 153 | |
| 154 | pub fn write_pages(output_path: &Path, pages: HashMap<String, String>) -> anyhow::Result<()> { |
| 155 | let errors_folder_path = output_path.join("errors"); |
no outgoing calls