Introduce a registry into the conversion to intermediate format.
This commit is contained in:
@@ -2,6 +2,7 @@ use std::path::PathBuf;
|
||||
|
||||
use crate::error::CustomError;
|
||||
|
||||
use super::registry::Registry;
|
||||
use super::IDocumentElement;
|
||||
use super::IHeading;
|
||||
use super::ISection;
|
||||
@@ -19,15 +20,16 @@ pub(crate) struct BlogPostPage {
|
||||
impl BlogPostPage {
|
||||
pub(crate) fn new<P: Into<PathBuf>>(
|
||||
path: P,
|
||||
document: organic::types::Document<'_>,
|
||||
registry: &mut Registry<'_>,
|
||||
document: &organic::types::Document<'_>,
|
||||
) -> Result<BlogPostPage, CustomError> {
|
||||
let path = path.into();
|
||||
let mut children = Vec::new();
|
||||
if let Some(section) = document.zeroth_section.as_ref() {
|
||||
children.push(IDocumentElement::Section(ISection::new(section)?));
|
||||
children.push(IDocumentElement::Section(ISection::new(registry, section)?));
|
||||
}
|
||||
for heading in document.children.iter() {
|
||||
children.push(IDocumentElement::Heading(IHeading::new(heading)?));
|
||||
children.push(IDocumentElement::Heading(IHeading::new(registry, heading)?));
|
||||
}
|
||||
|
||||
Ok(BlogPostPage {
|
||||
|
||||
Reference in New Issue
Block a user