Store the path to the original source file in the blog post object.

This commit is contained in:
Tom Alexander
2025-02-07 21:08:06 -05:00
parent 463be34302
commit 5cac44c625
4 changed files with 28 additions and 4 deletions

View File

@@ -13,6 +13,9 @@ pub(crate) struct IPage {
/// Relative path from the root of the pages directory.
pub(crate) path: PathBuf,
/// The path to the .org source for the file.
pub(crate) src: PathBuf,
pub(crate) title: Option<String>,
#[allow(dead_code)]
@@ -61,6 +64,7 @@ intermediate!(
Ok(IPage {
path: original.path,
src: original.src,
title: get_title(original.document),
date: get_date(original.document),
children,
@@ -80,17 +84,23 @@ impl IPage {
#[derive(Debug)]
pub(crate) struct PageInput<'b, 'parse> {
/// Relative path from the root of the page.
path: PathBuf,
/// The path to the .org source for the file.
src: PathBuf,
document: &'b organic::types::Document<'parse>,
}
impl<'b, 'parse> PageInput<'b, 'parse> {
pub(crate) fn new<P: Into<PathBuf>>(
pub(crate) fn new<P: Into<PathBuf>, S: Into<PathBuf>>(
path: P,
src: S,
document: &'b organic::types::Document<'parse>,
) -> PageInput<'b, 'parse> {
PageInput {
path: path.into(),
src: src.into(),
document,
}
}