Store the path to the original source file in the blog post object.
This commit is contained in:
parent
463be34302
commit
5cac44c625
@ -163,7 +163,7 @@ async fn load_pages(config: &Config) -> Result<Vec<IPage>, CustomError> {
|
|||||||
ret.push(
|
ret.push(
|
||||||
IPage::new(
|
IPage::new(
|
||||||
intermediate_context,
|
intermediate_context,
|
||||||
PageInput::new(relative_to_pages_dir_path, parsed_document),
|
PageInput::new(relative_to_pages_dir_path, real_path, parsed_document),
|
||||||
)
|
)
|
||||||
.await?,
|
.await?,
|
||||||
);
|
);
|
||||||
|
@ -76,7 +76,11 @@ impl BlogPost {
|
|||||||
ret.push(
|
ret.push(
|
||||||
BlogPostPage::new(
|
BlogPostPage::new(
|
||||||
intermediate_context,
|
intermediate_context,
|
||||||
BlogPostPageInput::new(relative_to_post_dir_path, parsed_document),
|
BlogPostPageInput::new(
|
||||||
|
relative_to_post_dir_path,
|
||||||
|
real_path,
|
||||||
|
parsed_document,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.await?,
|
.await?,
|
||||||
);
|
);
|
||||||
|
@ -11,17 +11,23 @@ use super::ISection;
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct BlogPostPageInput<'b, 'parse> {
|
pub(crate) struct BlogPostPageInput<'b, 'parse> {
|
||||||
|
/// Relative path from the root of the blog post.
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
|
|
||||||
|
/// The path to the .org source for the file.
|
||||||
|
src: PathBuf,
|
||||||
document: &'b organic::types::Document<'parse>,
|
document: &'b organic::types::Document<'parse>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'b, 'parse> BlogPostPageInput<'b, 'parse> {
|
impl<'b, 'parse> BlogPostPageInput<'b, 'parse> {
|
||||||
pub(crate) fn new<P: Into<PathBuf>>(
|
pub(crate) fn new<P: Into<PathBuf>, S: Into<PathBuf>>(
|
||||||
path: P,
|
path: P,
|
||||||
|
src: S,
|
||||||
document: &'b organic::types::Document<'parse>,
|
document: &'b organic::types::Document<'parse>,
|
||||||
) -> BlogPostPageInput<'b, 'parse> {
|
) -> BlogPostPageInput<'b, 'parse> {
|
||||||
BlogPostPageInput {
|
BlogPostPageInput {
|
||||||
path: path.into(),
|
path: path.into(),
|
||||||
|
src: src.into(),
|
||||||
document,
|
document,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -32,6 +38,9 @@ pub(crate) struct BlogPostPage {
|
|||||||
/// Relative path from the root of the blog post.
|
/// Relative path from the root of the blog post.
|
||||||
pub(crate) path: PathBuf,
|
pub(crate) path: PathBuf,
|
||||||
|
|
||||||
|
/// The path to the .org source for the file.
|
||||||
|
pub(crate) src: PathBuf,
|
||||||
|
|
||||||
pub(crate) title: Option<String>,
|
pub(crate) title: Option<String>,
|
||||||
|
|
||||||
pub(crate) date: Option<String>,
|
pub(crate) date: Option<String>,
|
||||||
@ -79,6 +88,7 @@ intermediate!(
|
|||||||
|
|
||||||
Ok(BlogPostPage {
|
Ok(BlogPostPage {
|
||||||
path: original.path,
|
path: original.path,
|
||||||
|
src: original.src,
|
||||||
title: get_title(original.document),
|
title: get_title(original.document),
|
||||||
date: get_date(original.document),
|
date: get_date(original.document),
|
||||||
children,
|
children,
|
||||||
|
@ -13,6 +13,9 @@ pub(crate) struct IPage {
|
|||||||
/// Relative path from the root of the pages directory.
|
/// Relative path from the root of the pages directory.
|
||||||
pub(crate) path: PathBuf,
|
pub(crate) path: PathBuf,
|
||||||
|
|
||||||
|
/// The path to the .org source for the file.
|
||||||
|
pub(crate) src: PathBuf,
|
||||||
|
|
||||||
pub(crate) title: Option<String>,
|
pub(crate) title: Option<String>,
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
@ -61,6 +64,7 @@ intermediate!(
|
|||||||
|
|
||||||
Ok(IPage {
|
Ok(IPage {
|
||||||
path: original.path,
|
path: original.path,
|
||||||
|
src: original.src,
|
||||||
title: get_title(original.document),
|
title: get_title(original.document),
|
||||||
date: get_date(original.document),
|
date: get_date(original.document),
|
||||||
children,
|
children,
|
||||||
@ -80,17 +84,23 @@ impl IPage {
|
|||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct PageInput<'b, 'parse> {
|
pub(crate) struct PageInput<'b, 'parse> {
|
||||||
|
/// Relative path from the root of the page.
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
|
|
||||||
|
/// The path to the .org source for the file.
|
||||||
|
src: PathBuf,
|
||||||
document: &'b organic::types::Document<'parse>,
|
document: &'b organic::types::Document<'parse>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'b, 'parse> PageInput<'b, '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,
|
path: P,
|
||||||
|
src: S,
|
||||||
document: &'b organic::types::Document<'parse>,
|
document: &'b organic::types::Document<'parse>,
|
||||||
) -> PageInput<'b, 'parse> {
|
) -> PageInput<'b, 'parse> {
|
||||||
PageInput {
|
PageInput {
|
||||||
path: path.into(),
|
path: path.into(),
|
||||||
|
src: src.into(),
|
||||||
document,
|
document,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user