Add regular link.
This commit is contained in:
parent
793789bdf2
commit
3d89492518
@ -1 +1 @@
|
|||||||
regular_link
|
<a href="{path}">{#.children}{>object/}{/.children}</a>
|
||||||
|
@ -6,18 +6,39 @@ use crate::config::Config;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::IRegularLink;
|
use crate::intermediate::IRegularLink;
|
||||||
|
|
||||||
|
use super::RenderObject;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
#[serde(rename = "regular_link")]
|
#[serde(rename = "regular_link")]
|
||||||
pub(crate) struct RenderRegularLink {}
|
pub(crate) struct RenderRegularLink {
|
||||||
|
path: String,
|
||||||
|
children: Vec<RenderObject>,
|
||||||
|
}
|
||||||
|
|
||||||
impl RenderRegularLink {
|
impl RenderRegularLink {
|
||||||
pub(crate) fn new(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: &Path,
|
output_directory: &Path,
|
||||||
output_file: &Path,
|
output_file: &Path,
|
||||||
comment: &IRegularLink,
|
regular_link: &IRegularLink,
|
||||||
) -> Result<RenderRegularLink, CustomError> {
|
) -> Result<RenderRegularLink, CustomError> {
|
||||||
Ok(RenderRegularLink {})
|
let children = {
|
||||||
|
let mut ret = Vec::new();
|
||||||
|
for obj in regular_link.children.iter() {
|
||||||
|
ret.push(RenderObject::new(
|
||||||
|
config,
|
||||||
|
&output_directory,
|
||||||
|
&output_file,
|
||||||
|
obj,
|
||||||
|
)?);
|
||||||
|
}
|
||||||
|
ret
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(RenderRegularLink {
|
||||||
|
path: regular_link.path.clone(),
|
||||||
|
children,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,29 @@
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
|
|
||||||
use super::registry::Registry;
|
use super::registry::Registry;
|
||||||
|
use super::IObject;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct IRegularLink {}
|
pub(crate) struct IRegularLink {
|
||||||
|
pub(crate) path: String,
|
||||||
|
pub(crate) children: Vec<IObject>,
|
||||||
|
}
|
||||||
|
|
||||||
impl IRegularLink {
|
impl IRegularLink {
|
||||||
pub(crate) async fn new<'parse>(
|
pub(crate) async fn new<'parse>(
|
||||||
registry: &mut Registry<'parse>,
|
registry: &mut Registry<'parse>,
|
||||||
original: &organic::types::RegularLink<'parse>,
|
original: &organic::types::RegularLink<'parse>,
|
||||||
) -> Result<IRegularLink, CustomError> {
|
) -> Result<IRegularLink, CustomError> {
|
||||||
Ok(IRegularLink {})
|
let children = {
|
||||||
|
let mut ret = Vec::new();
|
||||||
|
for obj in original.children.iter() {
|
||||||
|
ret.push(IObject::new(registry, obj).await?);
|
||||||
|
}
|
||||||
|
ret
|
||||||
|
};
|
||||||
|
Ok(IRegularLink {
|
||||||
|
path: original.path.as_ref().to_owned(),
|
||||||
|
children,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user