//! Minijinja-backed page renderers for the HTMX-SSR rendering profile.
//!
//! Provides generic page bodies (post viewer, 404) rendered from `.j2`
//! templates. The Minijinja `Environment` is owned by the project server crate;
//! call [`environment::setup`] after creating it and before the first render.
//!
//! Template source path is exported at build time via the
//! `RUSTELO_PAGES_HTMX_TEMPLATES` env var for use in downstream `build.rs`
//! scripts that merge framework templates into the runtime template directory.

pub mod environment;
pub mod error;
pub mod fragment_env;
pub mod pages;
pub mod render;

pub use environment::setup as setup_environment;
pub use error::RenderError;
pub use fragment_env::{fragment_env, register_fragment_env};
pub use pages::{render_not_found_page, render_post_page};
pub use render::render_safe;

/// Absolute path to this crate's `templates/` directory, resolved at build
/// time.
///
/// Use as the default loader path in the project server's `Environment` setup.
/// Override at runtime with the `HTMX_TEMPLATE_PATH` environment variable for
/// production deployments that copy templates to a separate directory.
pub const TEMPLATES_DIR: &str = env!("RUSTELO_PAGES_HTMX_TEMPLATES");
