pub fn render_timetable(
week: &Week,
config: &Config,
map_content: &str,
output_path: &Path,
) -> Result<(), RenderError>Expand description
Render a timetable week to an SVG file.
Generates an A4-sized (210mm × 297mm) SVG document containing:
- A formatted timetable grid with student name, week identifier, and lessons
- Color-coded cells based on room-to-department mappings
- Break and lunch period rows
- An embedded school map with highlighted departments
§Arguments
week- The week data to renderconfig- Configuration for room mappings and stylingmap_content- Processed SVG map content (fromprocess_map)output_path- Path where the SVG file will be written
§Returns
Ok(()) if the SVG was successfully generated and written.
§Errors
Returns RenderError if:
- The output file cannot be created or written
- The output directory doesn’t exist
§Example
use timetable_core::{config::Config, parser::{parse_pdf, Week}, renderer::render_timetable};
use std::path::Path;
let config = Config::load(Path::new("config.toml"))?;
let weeks = parse_pdf(Path::new("input/timetable.pdf"))?;
let map_svg = "<svg></svg>"; // Processed map content
for (i, week) in weeks.iter().enumerate() {
let output = format!("output/week_{}.svg", i + 1);
render_timetable(week, &config, map_svg, Path::new(&output))?;
}