cartulary 0.3.0-alpha.1

The knowledge layer of your project — decisions, issues, docs, all in one place.
Documentation
use super::SitePath;

/// A rendered, textual site entry — typically HTML, but anything that
/// makes sense as a UTF-8 string (XML feeds, sitemap, search.json).
///
/// `body` is `String` rather than `Vec<u8>` because the distinction
/// from [`SiteAsset`] is structural: pages are text under cartulary's
/// rendering pipeline, assets are opaque bytes copied through.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SitePage {
    pub path: SitePath,
    pub body: String,
}

impl SitePage {
    pub fn new(path: SitePath, body: impl Into<String>) -> Self {
        SitePage {
            path,
            body: body.into(),
        }
    }
}

#[cfg(test)]
pub mod strategy {
    use super::*;
    use proptest::prelude::*;

    pub fn site_page() -> impl Strategy<Value = SitePage> {
        (super::super::site_path::strategy::site_path(), ".{0,200}")
            .prop_map(|(path, body)| SitePage::new(path, body))
    }
}