timetable_core/
lib.rs

1//! # Timetable Core Library
2//!
3//! This library provides functionality for parsing Bromcom PDF timetables and generating
4//! formatted SVG visualizations with color-coded department maps.
5//!
6//! ## Features
7//!
8//! - Parse Bromcom timetable PDFs using coordinate-based text extraction
9//! - Configure room-to-department mappings with customizable colors
10//! - Apply per-week/day/period overrides to correct parsing errors
11//! - Highlight school map SVGs based on department locations
12//! - Render A4-sized SVG timetables with embedded maps
13//!
14//! ## Example Usage
15//!
16//! ```no_run
17//! use timetable_core::{config::Config, parser::parse_pdf, renderer::render_timetable, processor::{process_map, MapHighlight}};
18//! use std::path::Path;
19//! use std::collections::HashSet;
20//!
21//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
22//! // Load configuration
23//! let config = Config::load(Path::new("config.toml"))?;
24//!
25//! // Parse PDF timetable
26//! let mut weeks = parse_pdf(Path::new("input/timetable.pdf"))?;
27//!
28//! // Apply overrides from config
29//! config.apply_overrides(&mut weeks);
30//!
31//! // Render each week to SVG
32//! for (i, week) in weeks.iter().enumerate() {
33//!     // Build highlights for departments used in this week
34//!     let mut highlights = Vec::new();
35//!     let mut seen_ids = HashSet::new();
36//!
37//!     for lesson in &week.lessons {
38//!         if let Some(mapping) = config.get_style_for_room(&lesson.room) {
39//!             if seen_ids.insert(mapping.map_id.clone()) {
40//!                 highlights.push(MapHighlight {
41//!                     id: mapping.map_id.clone(),
42//!                     color: mapping.bg_color.clone(),
43//!                 });
44//!             }
45//!         }
46//!     }
47//!
48//!     // Process school map with highlights
49//!     let map_svg = process_map(Path::new("resources/map.svg"), &highlights)?;
50//!
51//!     // Render to output file
52//!     let output_path = format!("output/week_{}.svg", i + 1);
53//!     render_timetable(week, &config, &map_svg, Path::new(&output_path))?;
54//! }
55//! # Ok(())
56//! # }
57//! ```
58//!
59//! ## Modules
60//!
61//! - [`config`]: Configuration loading and room-to-department mapping
62//! - [`parser`]: PDF parsing and text extraction from Bromcom PDFs
63//! - [`processor`]: SVG map manipulation and department highlighting
64//! - [`renderer`]: Timetable SVG generation with embedded maps
65
66pub mod config;
67pub mod parser;
68pub mod processor;
69pub mod renderer;
70
71pub fn hello() {
72    println!("Hello from core!");
73}