diff --git a/src/command/build/runner.rs b/src/command/build/runner.rs index a4aa01b..835a4f4 100644 --- a/src/command/build/runner.rs +++ b/src/command/build/runner.rs @@ -163,7 +163,7 @@ async fn load_pages(config: &Config) -> Result, CustomError> { ret.push( IPage::new( intermediate_context, - PageInput::new(relative_to_pages_dir_path, parsed_document), + PageInput::new(relative_to_pages_dir_path, real_path, parsed_document), ) .await?, ); diff --git a/src/intermediate/blog_post.rs b/src/intermediate/blog_post.rs index b09227f..246959a 100644 --- a/src/intermediate/blog_post.rs +++ b/src/intermediate/blog_post.rs @@ -76,7 +76,11 @@ impl BlogPost { ret.push( BlogPostPage::new( intermediate_context, - BlogPostPageInput::new(relative_to_post_dir_path, parsed_document), + BlogPostPageInput::new( + relative_to_post_dir_path, + real_path, + parsed_document, + ), ) .await?, ); diff --git a/src/intermediate/blog_post_page.rs b/src/intermediate/blog_post_page.rs index dec8273..55a81fe 100644 --- a/src/intermediate/blog_post_page.rs +++ b/src/intermediate/blog_post_page.rs @@ -11,17 +11,23 @@ use super::ISection; #[derive(Debug)] pub(crate) struct BlogPostPageInput<'b, 'parse> { + /// Relative path from the root of the blog post. path: PathBuf, + + /// The path to the .org source for the file. + src: PathBuf, document: &'b organic::types::Document<'parse>, } impl<'b, 'parse> BlogPostPageInput<'b, 'parse> { - pub(crate) fn new>( + pub(crate) fn new, S: Into>( path: P, + src: S, document: &'b organic::types::Document<'parse>, ) -> BlogPostPageInput<'b, 'parse> { BlogPostPageInput { path: path.into(), + src: src.into(), document, } } @@ -32,6 +38,9 @@ pub(crate) struct BlogPostPage { /// Relative path from the root of the blog post. pub(crate) path: PathBuf, + /// The path to the .org source for the file. + pub(crate) src: PathBuf, + pub(crate) title: Option, pub(crate) date: Option, @@ -79,6 +88,7 @@ intermediate!( Ok(BlogPostPage { path: original.path, + src: original.src, title: get_title(original.document), date: get_date(original.document), children, diff --git a/src/intermediate/page.rs b/src/intermediate/page.rs index 45e042d..6c673c5 100644 --- a/src/intermediate/page.rs +++ b/src/intermediate/page.rs @@ -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, #[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>( + pub(crate) fn new, S: Into>( path: P, + src: S, document: &'b organic::types::Document<'parse>, ) -> PageInput<'b, 'parse> { PageInput { path: path.into(), + src: src.into(), document, } }