Add children to heading.
This commit is contained in:
parent
bd982fb62d
commit
c279bad13a
111
Cargo.lock
generated
111
Cargo.lock
generated
@ -71,6 +71,12 @@ version = "0.5.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "backtrace"
|
name = "backtrace"
|
||||||
version = "0.3.69"
|
version = "0.3.69"
|
||||||
@ -192,6 +198,95 @@ version = "1.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7"
|
checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures"
|
||||||
|
version = "0.3.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335"
|
||||||
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-executor",
|
||||||
|
"futures-io",
|
||||||
|
"futures-sink",
|
||||||
|
"futures-task",
|
||||||
|
"futures-util",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-channel"
|
||||||
|
version = "0.3.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
"futures-sink",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-core"
|
||||||
|
version = "0.3.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-executor"
|
||||||
|
version = "0.3.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
"futures-task",
|
||||||
|
"futures-util",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-io"
|
||||||
|
version = "0.3.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-macro"
|
||||||
|
version = "0.3.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-sink"
|
||||||
|
version = "0.3.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-task"
|
||||||
|
version = "0.3.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "futures-util"
|
||||||
|
version = "0.3.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104"
|
||||||
|
dependencies = [
|
||||||
|
"futures-channel",
|
||||||
|
"futures-core",
|
||||||
|
"futures-io",
|
||||||
|
"futures-macro",
|
||||||
|
"futures-sink",
|
||||||
|
"futures-task",
|
||||||
|
"memchr",
|
||||||
|
"pin-project-lite",
|
||||||
|
"pin-utils",
|
||||||
|
"slab",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gimli"
|
name = "gimli"
|
||||||
version = "0.28.0"
|
version = "0.28.0"
|
||||||
@ -347,6 +442,12 @@ version = "0.2.13"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pin-utils"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.69"
|
version = "1.0.69"
|
||||||
@ -432,6 +533,15 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slab"
|
||||||
|
version = "0.4.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "static_assertions"
|
name = "static_assertions"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@ -641,6 +751,7 @@ version = "0.0.1"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"duster",
|
"duster",
|
||||||
|
"futures",
|
||||||
"include_dir",
|
"include_dir",
|
||||||
"organic",
|
"organic",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -8,6 +8,7 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.4.6", default-features = false, features = ["std", "color", "help", "derive"] }
|
clap = { version = "4.4.6", default-features = false, features = ["std", "color", "help", "derive"] }
|
||||||
duster = { git = "https://code.fizz.buzz/talexander/duster.git", branch = "master" }
|
duster = { git = "https://code.fizz.buzz/talexander/duster.git", branch = "master" }
|
||||||
|
futures = "0.3.29"
|
||||||
include_dir = "0.7.3"
|
include_dir = "0.7.3"
|
||||||
# TODO: This is temporary to work on the latest organic code. Eventually switch back to using the published crate.
|
# TODO: This is temporary to work on the latest organic code. Eventually switch back to using the published crate.
|
||||||
organic = { path = "../organic" }
|
organic = { path = "../organic" }
|
||||||
|
@ -1 +1,11 @@
|
|||||||
heading
|
{@lte key=.level value=4}
|
||||||
|
<h{.level}>{#.title}{>object/}{/.title}</h{.level}>
|
||||||
|
{:else}
|
||||||
|
<ol>
|
||||||
|
<li>{#.title}{>object/}{/.title}</li>
|
||||||
|
</ol>
|
||||||
|
{/lte}
|
||||||
|
|
||||||
|
{#.children}
|
||||||
|
{>document_element/}
|
||||||
|
{/.children}
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IAngleLink;
|
|||||||
pub(crate) struct RenderAngleLink {}
|
pub(crate) struct RenderAngleLink {}
|
||||||
|
|
||||||
impl RenderAngleLink {
|
impl RenderAngleLink {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IAngleLink,
|
comment: &IAngleLink,
|
||||||
) -> Result<RenderAngleLink, CustomError> {
|
) -> Result<RenderAngleLink, CustomError> {
|
||||||
Ok(RenderAngleLink {})
|
Ok(RenderAngleLink {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IBabelCall;
|
|||||||
pub(crate) struct RenderBabelCall {}
|
pub(crate) struct RenderBabelCall {}
|
||||||
|
|
||||||
impl RenderBabelCall {
|
impl RenderBabelCall {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IBabelCall,
|
original: &IBabelCall,
|
||||||
) -> Result<RenderBabelCall, CustomError> {
|
) -> Result<RenderBabelCall, CustomError> {
|
||||||
Ok(RenderBabelCall {})
|
Ok(RenderBabelCall {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IBold;
|
|||||||
pub(crate) struct RenderBold {}
|
pub(crate) struct RenderBold {}
|
||||||
|
|
||||||
impl RenderBold {
|
impl RenderBold {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IBold,
|
comment: &IBold,
|
||||||
) -> Result<RenderBold, CustomError> {
|
) -> Result<RenderBold, CustomError> {
|
||||||
Ok(RenderBold {})
|
Ok(RenderBold {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ICenterBlock;
|
|||||||
pub(crate) struct RenderCenterBlock {}
|
pub(crate) struct RenderCenterBlock {}
|
||||||
|
|
||||||
impl RenderCenterBlock {
|
impl RenderCenterBlock {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &ICenterBlock,
|
original: &ICenterBlock,
|
||||||
) -> Result<RenderCenterBlock, CustomError> {
|
) -> Result<RenderCenterBlock, CustomError> {
|
||||||
Ok(RenderCenterBlock {})
|
Ok(RenderCenterBlock {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ICitation;
|
|||||||
pub(crate) struct RenderCitation {}
|
pub(crate) struct RenderCitation {}
|
||||||
|
|
||||||
impl RenderCitation {
|
impl RenderCitation {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &ICitation,
|
comment: &ICitation,
|
||||||
) -> Result<RenderCitation, CustomError> {
|
) -> Result<RenderCitation, CustomError> {
|
||||||
Ok(RenderCitation {})
|
Ok(RenderCitation {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ICitationReference;
|
|||||||
pub(crate) struct RenderCitationReference {}
|
pub(crate) struct RenderCitationReference {}
|
||||||
|
|
||||||
impl RenderCitationReference {
|
impl RenderCitationReference {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &ICitationReference,
|
comment: &ICitationReference,
|
||||||
) -> Result<RenderCitationReference, CustomError> {
|
) -> Result<RenderCitationReference, CustomError> {
|
||||||
Ok(RenderCitationReference {})
|
Ok(RenderCitationReference {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IClock;
|
|||||||
pub(crate) struct RenderClock {}
|
pub(crate) struct RenderClock {}
|
||||||
|
|
||||||
impl RenderClock {
|
impl RenderClock {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IClock,
|
original: &IClock,
|
||||||
) -> Result<RenderClock, CustomError> {
|
) -> Result<RenderClock, CustomError> {
|
||||||
Ok(RenderClock {})
|
Ok(RenderClock {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ICode;
|
|||||||
pub(crate) struct RenderCode {}
|
pub(crate) struct RenderCode {}
|
||||||
|
|
||||||
impl RenderCode {
|
impl RenderCode {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &ICode,
|
comment: &ICode,
|
||||||
) -> Result<RenderCode, CustomError> {
|
) -> Result<RenderCode, CustomError> {
|
||||||
Ok(RenderCode {})
|
Ok(RenderCode {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IComment;
|
|||||||
pub(crate) struct RenderComment {}
|
pub(crate) struct RenderComment {}
|
||||||
|
|
||||||
impl RenderComment {
|
impl RenderComment {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IComment,
|
comment: &IComment,
|
||||||
) -> Result<RenderComment, CustomError> {
|
) -> Result<RenderComment, CustomError> {
|
||||||
Ok(RenderComment {})
|
Ok(RenderComment {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ICommentBlock;
|
|||||||
pub(crate) struct RenderCommentBlock {}
|
pub(crate) struct RenderCommentBlock {}
|
||||||
|
|
||||||
impl RenderCommentBlock {
|
impl RenderCommentBlock {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &ICommentBlock,
|
original: &ICommentBlock,
|
||||||
) -> Result<RenderCommentBlock, CustomError> {
|
) -> Result<RenderCommentBlock, CustomError> {
|
||||||
Ok(RenderCommentBlock {})
|
Ok(RenderCommentBlock {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IDiarySexp;
|
|||||||
pub(crate) struct RenderDiarySexp {}
|
pub(crate) struct RenderDiarySexp {}
|
||||||
|
|
||||||
impl RenderDiarySexp {
|
impl RenderDiarySexp {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IDiarySexp,
|
original: &IDiarySexp,
|
||||||
) -> Result<RenderDiarySexp, CustomError> {
|
) -> Result<RenderDiarySexp, CustomError> {
|
||||||
Ok(RenderDiarySexp {})
|
Ok(RenderDiarySexp {})
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
|
use std::path::Path;
|
||||||
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
|
use crate::config::Config;
|
||||||
|
use crate::error::CustomError;
|
||||||
|
use crate::intermediate::IDocumentElement;
|
||||||
|
|
||||||
use super::RenderHeading;
|
use super::RenderHeading;
|
||||||
use super::RenderSection;
|
use super::RenderSection;
|
||||||
|
|
||||||
@ -9,3 +15,21 @@ pub(crate) enum RenderDocumentElement {
|
|||||||
Heading(RenderHeading),
|
Heading(RenderHeading),
|
||||||
Section(RenderSection),
|
Section(RenderSection),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl RenderDocumentElement {
|
||||||
|
pub(crate) fn new(
|
||||||
|
config: &Config,
|
||||||
|
output_directory: &Path,
|
||||||
|
output_file: &Path,
|
||||||
|
original: &IDocumentElement,
|
||||||
|
) -> Result<RenderDocumentElement, CustomError> {
|
||||||
|
match original {
|
||||||
|
IDocumentElement::Heading(inner) => Ok(RenderDocumentElement::Heading(
|
||||||
|
RenderHeading::new(config, output_directory, output_file, inner)?,
|
||||||
|
)),
|
||||||
|
IDocumentElement::Section(inner) => Ok(RenderDocumentElement::Section(
|
||||||
|
RenderSection::new(config, output_directory, output_file, inner)?,
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IDrawer;
|
|||||||
pub(crate) struct RenderDrawer {}
|
pub(crate) struct RenderDrawer {}
|
||||||
|
|
||||||
impl RenderDrawer {
|
impl RenderDrawer {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IDrawer,
|
original: &IDrawer,
|
||||||
) -> Result<RenderDrawer, CustomError> {
|
) -> Result<RenderDrawer, CustomError> {
|
||||||
Ok(RenderDrawer {})
|
Ok(RenderDrawer {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IDynamicBlock;
|
|||||||
pub(crate) struct RenderDynamicBlock {}
|
pub(crate) struct RenderDynamicBlock {}
|
||||||
|
|
||||||
impl RenderDynamicBlock {
|
impl RenderDynamicBlock {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IDynamicBlock,
|
original: &IDynamicBlock,
|
||||||
) -> Result<RenderDynamicBlock, CustomError> {
|
) -> Result<RenderDynamicBlock, CustomError> {
|
||||||
Ok(RenderDynamicBlock {})
|
Ok(RenderDynamicBlock {})
|
||||||
|
@ -61,10 +61,10 @@ pub(crate) enum RenderElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RenderElement {
|
impl RenderElement {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
element: &IElement,
|
element: &IElement,
|
||||||
) -> Result<RenderElement, CustomError> {
|
) -> Result<RenderElement, CustomError> {
|
||||||
match element {
|
match element {
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IEntity;
|
|||||||
pub(crate) struct RenderEntity {}
|
pub(crate) struct RenderEntity {}
|
||||||
|
|
||||||
impl RenderEntity {
|
impl RenderEntity {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IEntity,
|
comment: &IEntity,
|
||||||
) -> Result<RenderEntity, CustomError> {
|
) -> Result<RenderEntity, CustomError> {
|
||||||
Ok(RenderEntity {})
|
Ok(RenderEntity {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IExampleBlock;
|
|||||||
pub(crate) struct RenderExampleBlock {}
|
pub(crate) struct RenderExampleBlock {}
|
||||||
|
|
||||||
impl RenderExampleBlock {
|
impl RenderExampleBlock {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IExampleBlock,
|
original: &IExampleBlock,
|
||||||
) -> Result<RenderExampleBlock, CustomError> {
|
) -> Result<RenderExampleBlock, CustomError> {
|
||||||
Ok(RenderExampleBlock {})
|
Ok(RenderExampleBlock {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IExportBlock;
|
|||||||
pub(crate) struct RenderExportBlock {}
|
pub(crate) struct RenderExportBlock {}
|
||||||
|
|
||||||
impl RenderExportBlock {
|
impl RenderExportBlock {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IExportBlock,
|
original: &IExportBlock,
|
||||||
) -> Result<RenderExportBlock, CustomError> {
|
) -> Result<RenderExportBlock, CustomError> {
|
||||||
Ok(RenderExportBlock {})
|
Ok(RenderExportBlock {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IExportSnippet;
|
|||||||
pub(crate) struct RenderExportSnippet {}
|
pub(crate) struct RenderExportSnippet {}
|
||||||
|
|
||||||
impl RenderExportSnippet {
|
impl RenderExportSnippet {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IExportSnippet,
|
comment: &IExportSnippet,
|
||||||
) -> Result<RenderExportSnippet, CustomError> {
|
) -> Result<RenderExportSnippet, CustomError> {
|
||||||
Ok(RenderExportSnippet {})
|
Ok(RenderExportSnippet {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IFixedWidthArea;
|
|||||||
pub(crate) struct RenderFixedWidthArea {}
|
pub(crate) struct RenderFixedWidthArea {}
|
||||||
|
|
||||||
impl RenderFixedWidthArea {
|
impl RenderFixedWidthArea {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IFixedWidthArea,
|
original: &IFixedWidthArea,
|
||||||
) -> Result<RenderFixedWidthArea, CustomError> {
|
) -> Result<RenderFixedWidthArea, CustomError> {
|
||||||
Ok(RenderFixedWidthArea {})
|
Ok(RenderFixedWidthArea {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IFootnoteDefinition;
|
|||||||
pub(crate) struct RenderFootnoteDefinition {}
|
pub(crate) struct RenderFootnoteDefinition {}
|
||||||
|
|
||||||
impl RenderFootnoteDefinition {
|
impl RenderFootnoteDefinition {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IFootnoteDefinition,
|
original: &IFootnoteDefinition,
|
||||||
) -> Result<RenderFootnoteDefinition, CustomError> {
|
) -> Result<RenderFootnoteDefinition, CustomError> {
|
||||||
Ok(RenderFootnoteDefinition {})
|
Ok(RenderFootnoteDefinition {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IFootnoteReference;
|
|||||||
pub(crate) struct RenderFootnoteReference {}
|
pub(crate) struct RenderFootnoteReference {}
|
||||||
|
|
||||||
impl RenderFootnoteReference {
|
impl RenderFootnoteReference {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IFootnoteReference,
|
comment: &IFootnoteReference,
|
||||||
) -> Result<RenderFootnoteReference, CustomError> {
|
) -> Result<RenderFootnoteReference, CustomError> {
|
||||||
Ok(RenderFootnoteReference {})
|
Ok(RenderFootnoteReference {})
|
||||||
|
@ -6,6 +6,7 @@ use crate::config::Config;
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
use crate::intermediate::IHeading;
|
use crate::intermediate::IHeading;
|
||||||
|
|
||||||
|
use super::RenderDocumentElement;
|
||||||
use super::RenderObject;
|
use super::RenderObject;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
@ -14,23 +15,46 @@ use super::RenderObject;
|
|||||||
pub(crate) struct RenderHeading {
|
pub(crate) struct RenderHeading {
|
||||||
level: organic::types::HeadlineLevel,
|
level: organic::types::HeadlineLevel,
|
||||||
title: Vec<RenderObject>,
|
title: Vec<RenderObject>,
|
||||||
|
children: Vec<RenderDocumentElement>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RenderHeading {
|
impl RenderHeading {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
heading: &IHeading,
|
heading: &IHeading,
|
||||||
) -> Result<RenderHeading, CustomError> {
|
) -> Result<RenderHeading, CustomError> {
|
||||||
let title = heading
|
let title = {
|
||||||
.title
|
let mut ret = Vec::new();
|
||||||
.iter()
|
for obj in heading.title.iter() {
|
||||||
.map(|obj| RenderObject::new(config, &output_directory, &output_file, obj))
|
ret.push(RenderObject::new(
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
config,
|
||||||
|
&output_directory,
|
||||||
|
&output_file,
|
||||||
|
obj,
|
||||||
|
)?);
|
||||||
|
}
|
||||||
|
ret
|
||||||
|
};
|
||||||
|
|
||||||
|
let children = {
|
||||||
|
let mut ret = Vec::new();
|
||||||
|
for obj in heading.children.iter() {
|
||||||
|
ret.push(RenderDocumentElement::new(
|
||||||
|
config,
|
||||||
|
&output_directory,
|
||||||
|
&output_file,
|
||||||
|
obj,
|
||||||
|
)?);
|
||||||
|
}
|
||||||
|
ret
|
||||||
|
};
|
||||||
|
|
||||||
Ok(RenderHeading {
|
Ok(RenderHeading {
|
||||||
level: heading.level,
|
level: heading.level + 1, // Adding 1 because the page title is going to be h1.
|
||||||
title,
|
title,
|
||||||
|
children,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IHorizontalRule;
|
|||||||
pub(crate) struct RenderHorizontalRule {}
|
pub(crate) struct RenderHorizontalRule {}
|
||||||
|
|
||||||
impl RenderHorizontalRule {
|
impl RenderHorizontalRule {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IHorizontalRule,
|
original: &IHorizontalRule,
|
||||||
) -> Result<RenderHorizontalRule, CustomError> {
|
) -> Result<RenderHorizontalRule, CustomError> {
|
||||||
Ok(RenderHorizontalRule {})
|
Ok(RenderHorizontalRule {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IInlineBabelCall;
|
|||||||
pub(crate) struct RenderInlineBabelCall {}
|
pub(crate) struct RenderInlineBabelCall {}
|
||||||
|
|
||||||
impl RenderInlineBabelCall {
|
impl RenderInlineBabelCall {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IInlineBabelCall,
|
comment: &IInlineBabelCall,
|
||||||
) -> Result<RenderInlineBabelCall, CustomError> {
|
) -> Result<RenderInlineBabelCall, CustomError> {
|
||||||
Ok(RenderInlineBabelCall {})
|
Ok(RenderInlineBabelCall {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IInlineSourceBlock;
|
|||||||
pub(crate) struct RenderInlineSourceBlock {}
|
pub(crate) struct RenderInlineSourceBlock {}
|
||||||
|
|
||||||
impl RenderInlineSourceBlock {
|
impl RenderInlineSourceBlock {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IInlineSourceBlock,
|
comment: &IInlineSourceBlock,
|
||||||
) -> Result<RenderInlineSourceBlock, CustomError> {
|
) -> Result<RenderInlineSourceBlock, CustomError> {
|
||||||
Ok(RenderInlineSourceBlock {})
|
Ok(RenderInlineSourceBlock {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IItalic;
|
|||||||
pub(crate) struct RenderItalic {}
|
pub(crate) struct RenderItalic {}
|
||||||
|
|
||||||
impl RenderItalic {
|
impl RenderItalic {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IItalic,
|
comment: &IItalic,
|
||||||
) -> Result<RenderItalic, CustomError> {
|
) -> Result<RenderItalic, CustomError> {
|
||||||
Ok(RenderItalic {})
|
Ok(RenderItalic {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IKeyword;
|
|||||||
pub(crate) struct RenderKeyword {}
|
pub(crate) struct RenderKeyword {}
|
||||||
|
|
||||||
impl RenderKeyword {
|
impl RenderKeyword {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
keyword: &IKeyword,
|
keyword: &IKeyword,
|
||||||
) -> Result<RenderKeyword, CustomError> {
|
) -> Result<RenderKeyword, CustomError> {
|
||||||
Ok(RenderKeyword {})
|
Ok(RenderKeyword {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ILatexEnvironment;
|
|||||||
pub(crate) struct RenderLatexEnvironment {}
|
pub(crate) struct RenderLatexEnvironment {}
|
||||||
|
|
||||||
impl RenderLatexEnvironment {
|
impl RenderLatexEnvironment {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &ILatexEnvironment,
|
original: &ILatexEnvironment,
|
||||||
) -> Result<RenderLatexEnvironment, CustomError> {
|
) -> Result<RenderLatexEnvironment, CustomError> {
|
||||||
Ok(RenderLatexEnvironment {})
|
Ok(RenderLatexEnvironment {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ILatexFragment;
|
|||||||
pub(crate) struct RenderLatexFragment {}
|
pub(crate) struct RenderLatexFragment {}
|
||||||
|
|
||||||
impl RenderLatexFragment {
|
impl RenderLatexFragment {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &ILatexFragment,
|
comment: &ILatexFragment,
|
||||||
) -> Result<RenderLatexFragment, CustomError> {
|
) -> Result<RenderLatexFragment, CustomError> {
|
||||||
Ok(RenderLatexFragment {})
|
Ok(RenderLatexFragment {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ILineBreak;
|
|||||||
pub(crate) struct RenderLineBreak {}
|
pub(crate) struct RenderLineBreak {}
|
||||||
|
|
||||||
impl RenderLineBreak {
|
impl RenderLineBreak {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &ILineBreak,
|
comment: &ILineBreak,
|
||||||
) -> Result<RenderLineBreak, CustomError> {
|
) -> Result<RenderLineBreak, CustomError> {
|
||||||
Ok(RenderLineBreak {})
|
Ok(RenderLineBreak {})
|
||||||
|
@ -67,10 +67,10 @@ pub(crate) enum RenderObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RenderObject {
|
impl RenderObject {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
object: &IObject,
|
object: &IObject,
|
||||||
) -> Result<RenderObject, CustomError> {
|
) -> Result<RenderObject, CustomError> {
|
||||||
match object {
|
match object {
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IOrgMacro;
|
|||||||
pub(crate) struct RenderOrgMacro {}
|
pub(crate) struct RenderOrgMacro {}
|
||||||
|
|
||||||
impl RenderOrgMacro {
|
impl RenderOrgMacro {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IOrgMacro,
|
comment: &IOrgMacro,
|
||||||
) -> Result<RenderOrgMacro, CustomError> {
|
) -> Result<RenderOrgMacro, CustomError> {
|
||||||
Ok(RenderOrgMacro {})
|
Ok(RenderOrgMacro {})
|
||||||
|
@ -16,17 +16,25 @@ pub(crate) struct RenderParagraph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RenderParagraph {
|
impl RenderParagraph {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
paragraph: &IParagraph,
|
paragraph: &IParagraph,
|
||||||
) -> Result<RenderParagraph, CustomError> {
|
) -> Result<RenderParagraph, CustomError> {
|
||||||
let children = paragraph
|
let children = {
|
||||||
.children
|
let mut ret = Vec::new();
|
||||||
.iter()
|
for obj in paragraph.children.iter() {
|
||||||
.map(|obj| RenderObject::new(config, &output_directory, &output_file, obj))
|
ret.push(RenderObject::new(
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
config,
|
||||||
|
&output_directory,
|
||||||
|
&output_file,
|
||||||
|
obj,
|
||||||
|
)?);
|
||||||
|
}
|
||||||
|
ret
|
||||||
|
};
|
||||||
|
|
||||||
Ok(RenderParagraph { children })
|
Ok(RenderParagraph { children })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IPlainLink;
|
|||||||
pub(crate) struct RenderPlainLink {}
|
pub(crate) struct RenderPlainLink {}
|
||||||
|
|
||||||
impl RenderPlainLink {
|
impl RenderPlainLink {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IPlainLink,
|
comment: &IPlainLink,
|
||||||
) -> Result<RenderPlainLink, CustomError> {
|
) -> Result<RenderPlainLink, CustomError> {
|
||||||
Ok(RenderPlainLink {})
|
Ok(RenderPlainLink {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IPlainList;
|
|||||||
pub(crate) struct RenderPlainList {}
|
pub(crate) struct RenderPlainList {}
|
||||||
|
|
||||||
impl RenderPlainList {
|
impl RenderPlainList {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IPlainList,
|
original: &IPlainList,
|
||||||
) -> Result<RenderPlainList, CustomError> {
|
) -> Result<RenderPlainList, CustomError> {
|
||||||
Ok(RenderPlainList {})
|
Ok(RenderPlainList {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IPlainText;
|
|||||||
pub(crate) struct RenderPlainText {}
|
pub(crate) struct RenderPlainText {}
|
||||||
|
|
||||||
impl RenderPlainText {
|
impl RenderPlainText {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
heading: &IPlainText,
|
heading: &IPlainText,
|
||||||
) -> Result<RenderPlainText, CustomError> {
|
) -> Result<RenderPlainText, CustomError> {
|
||||||
Ok(RenderPlainText {})
|
Ok(RenderPlainText {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IPlanning;
|
|||||||
pub(crate) struct RenderPlanning {}
|
pub(crate) struct RenderPlanning {}
|
||||||
|
|
||||||
impl RenderPlanning {
|
impl RenderPlanning {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IPlanning,
|
original: &IPlanning,
|
||||||
) -> Result<RenderPlanning, CustomError> {
|
) -> Result<RenderPlanning, CustomError> {
|
||||||
Ok(RenderPlanning {})
|
Ok(RenderPlanning {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IPropertyDrawer;
|
|||||||
pub(crate) struct RenderPropertyDrawer {}
|
pub(crate) struct RenderPropertyDrawer {}
|
||||||
|
|
||||||
impl RenderPropertyDrawer {
|
impl RenderPropertyDrawer {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IPropertyDrawer,
|
original: &IPropertyDrawer,
|
||||||
) -> Result<RenderPropertyDrawer, CustomError> {
|
) -> Result<RenderPropertyDrawer, CustomError> {
|
||||||
Ok(RenderPropertyDrawer {})
|
Ok(RenderPropertyDrawer {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IQuoteBlock;
|
|||||||
pub(crate) struct RenderQuoteBlock {}
|
pub(crate) struct RenderQuoteBlock {}
|
||||||
|
|
||||||
impl RenderQuoteBlock {
|
impl RenderQuoteBlock {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IQuoteBlock,
|
original: &IQuoteBlock,
|
||||||
) -> Result<RenderQuoteBlock, CustomError> {
|
) -> Result<RenderQuoteBlock, CustomError> {
|
||||||
Ok(RenderQuoteBlock {})
|
Ok(RenderQuoteBlock {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IRadioLink;
|
|||||||
pub(crate) struct RenderRadioLink {}
|
pub(crate) struct RenderRadioLink {}
|
||||||
|
|
||||||
impl RenderRadioLink {
|
impl RenderRadioLink {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IRadioLink,
|
comment: &IRadioLink,
|
||||||
) -> Result<RenderRadioLink, CustomError> {
|
) -> Result<RenderRadioLink, CustomError> {
|
||||||
Ok(RenderRadioLink {})
|
Ok(RenderRadioLink {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IRadioTarget;
|
|||||||
pub(crate) struct RenderRadioTarget {}
|
pub(crate) struct RenderRadioTarget {}
|
||||||
|
|
||||||
impl RenderRadioTarget {
|
impl RenderRadioTarget {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IRadioTarget,
|
comment: &IRadioTarget,
|
||||||
) -> Result<RenderRadioTarget, CustomError> {
|
) -> Result<RenderRadioTarget, CustomError> {
|
||||||
Ok(RenderRadioTarget {})
|
Ok(RenderRadioTarget {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IRegularLink;
|
|||||||
pub(crate) struct RenderRegularLink {}
|
pub(crate) struct RenderRegularLink {}
|
||||||
|
|
||||||
impl RenderRegularLink {
|
impl RenderRegularLink {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IRegularLink,
|
comment: &IRegularLink,
|
||||||
) -> Result<RenderRegularLink, CustomError> {
|
) -> Result<RenderRegularLink, CustomError> {
|
||||||
Ok(RenderRegularLink {})
|
Ok(RenderRegularLink {})
|
||||||
|
@ -16,17 +16,24 @@ pub(crate) struct RenderSection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RenderSection {
|
impl RenderSection {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
section: &ISection,
|
section: &ISection,
|
||||||
) -> Result<RenderSection, CustomError> {
|
) -> Result<RenderSection, CustomError> {
|
||||||
let children = section
|
let children = {
|
||||||
.children
|
let mut ret = Vec::new();
|
||||||
.iter()
|
for obj in section.children.iter() {
|
||||||
.map(|obj| RenderElement::new(config, &output_directory, &output_file, obj))
|
ret.push(RenderElement::new(
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
config,
|
||||||
|
&output_directory,
|
||||||
|
&output_file,
|
||||||
|
obj,
|
||||||
|
)?);
|
||||||
|
}
|
||||||
|
ret
|
||||||
|
};
|
||||||
|
|
||||||
Ok(RenderSection { children })
|
Ok(RenderSection { children })
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ISpecialBlock;
|
|||||||
pub(crate) struct RenderSpecialBlock {}
|
pub(crate) struct RenderSpecialBlock {}
|
||||||
|
|
||||||
impl RenderSpecialBlock {
|
impl RenderSpecialBlock {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &ISpecialBlock,
|
original: &ISpecialBlock,
|
||||||
) -> Result<RenderSpecialBlock, CustomError> {
|
) -> Result<RenderSpecialBlock, CustomError> {
|
||||||
Ok(RenderSpecialBlock {})
|
Ok(RenderSpecialBlock {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ISrcBlock;
|
|||||||
pub(crate) struct RenderSrcBlock {}
|
pub(crate) struct RenderSrcBlock {}
|
||||||
|
|
||||||
impl RenderSrcBlock {
|
impl RenderSrcBlock {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &ISrcBlock,
|
original: &ISrcBlock,
|
||||||
) -> Result<RenderSrcBlock, CustomError> {
|
) -> Result<RenderSrcBlock, CustomError> {
|
||||||
Ok(RenderSrcBlock {})
|
Ok(RenderSrcBlock {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IStatisticsCookie;
|
|||||||
pub(crate) struct RenderStatisticsCookie {}
|
pub(crate) struct RenderStatisticsCookie {}
|
||||||
|
|
||||||
impl RenderStatisticsCookie {
|
impl RenderStatisticsCookie {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IStatisticsCookie,
|
comment: &IStatisticsCookie,
|
||||||
) -> Result<RenderStatisticsCookie, CustomError> {
|
) -> Result<RenderStatisticsCookie, CustomError> {
|
||||||
Ok(RenderStatisticsCookie {})
|
Ok(RenderStatisticsCookie {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IStrikeThrough;
|
|||||||
pub(crate) struct RenderStrikeThrough {}
|
pub(crate) struct RenderStrikeThrough {}
|
||||||
|
|
||||||
impl RenderStrikeThrough {
|
impl RenderStrikeThrough {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IStrikeThrough,
|
comment: &IStrikeThrough,
|
||||||
) -> Result<RenderStrikeThrough, CustomError> {
|
) -> Result<RenderStrikeThrough, CustomError> {
|
||||||
Ok(RenderStrikeThrough {})
|
Ok(RenderStrikeThrough {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ISubscript;
|
|||||||
pub(crate) struct RenderSubscript {}
|
pub(crate) struct RenderSubscript {}
|
||||||
|
|
||||||
impl RenderSubscript {
|
impl RenderSubscript {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &ISubscript,
|
comment: &ISubscript,
|
||||||
) -> Result<RenderSubscript, CustomError> {
|
) -> Result<RenderSubscript, CustomError> {
|
||||||
Ok(RenderSubscript {})
|
Ok(RenderSubscript {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ISuperscript;
|
|||||||
pub(crate) struct RenderSuperscript {}
|
pub(crate) struct RenderSuperscript {}
|
||||||
|
|
||||||
impl RenderSuperscript {
|
impl RenderSuperscript {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &ISuperscript,
|
comment: &ISuperscript,
|
||||||
) -> Result<RenderSuperscript, CustomError> {
|
) -> Result<RenderSuperscript, CustomError> {
|
||||||
Ok(RenderSuperscript {})
|
Ok(RenderSuperscript {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ITable;
|
|||||||
pub(crate) struct RenderTable {}
|
pub(crate) struct RenderTable {}
|
||||||
|
|
||||||
impl RenderTable {
|
impl RenderTable {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &ITable,
|
original: &ITable,
|
||||||
) -> Result<RenderTable, CustomError> {
|
) -> Result<RenderTable, CustomError> {
|
||||||
Ok(RenderTable {})
|
Ok(RenderTable {})
|
||||||
|
@ -14,10 +14,10 @@ pub(crate) struct RenderTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RenderTarget {
|
impl RenderTarget {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
target: &ITarget,
|
target: &ITarget,
|
||||||
) -> Result<RenderTarget, CustomError> {
|
) -> Result<RenderTarget, CustomError> {
|
||||||
Ok(RenderTarget {
|
Ok(RenderTarget {
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::ITimestamp;
|
|||||||
pub(crate) struct RenderTimestamp {}
|
pub(crate) struct RenderTimestamp {}
|
||||||
|
|
||||||
impl RenderTimestamp {
|
impl RenderTimestamp {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &ITimestamp,
|
comment: &ITimestamp,
|
||||||
) -> Result<RenderTimestamp, CustomError> {
|
) -> Result<RenderTimestamp, CustomError> {
|
||||||
Ok(RenderTimestamp {})
|
Ok(RenderTimestamp {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IUnderline;
|
|||||||
pub(crate) struct RenderUnderline {}
|
pub(crate) struct RenderUnderline {}
|
||||||
|
|
||||||
impl RenderUnderline {
|
impl RenderUnderline {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IUnderline,
|
comment: &IUnderline,
|
||||||
) -> Result<RenderUnderline, CustomError> {
|
) -> Result<RenderUnderline, CustomError> {
|
||||||
Ok(RenderUnderline {})
|
Ok(RenderUnderline {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IVerbatim;
|
|||||||
pub(crate) struct RenderVerbatim {}
|
pub(crate) struct RenderVerbatim {}
|
||||||
|
|
||||||
impl RenderVerbatim {
|
impl RenderVerbatim {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
comment: &IVerbatim,
|
comment: &IVerbatim,
|
||||||
) -> Result<RenderVerbatim, CustomError> {
|
) -> Result<RenderVerbatim, CustomError> {
|
||||||
Ok(RenderVerbatim {})
|
Ok(RenderVerbatim {})
|
||||||
|
@ -12,10 +12,10 @@ use crate::intermediate::IVerseBlock;
|
|||||||
pub(crate) struct RenderVerseBlock {}
|
pub(crate) struct RenderVerseBlock {}
|
||||||
|
|
||||||
impl RenderVerseBlock {
|
impl RenderVerseBlock {
|
||||||
pub(crate) fn new<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn new(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
output_directory: D,
|
output_directory: &Path,
|
||||||
output_file: F,
|
output_file: &Path,
|
||||||
original: &IVerseBlock,
|
original: &IVerseBlock,
|
||||||
) -> Result<RenderVerseBlock, CustomError> {
|
) -> Result<RenderVerseBlock, CustomError> {
|
||||||
Ok(RenderVerseBlock {})
|
Ok(RenderVerseBlock {})
|
||||||
|
@ -6,13 +6,10 @@ use crate::config::Config;
|
|||||||
use crate::context::GlobalSettings;
|
use crate::context::GlobalSettings;
|
||||||
use crate::context::RenderBlogPostPage;
|
use crate::context::RenderBlogPostPage;
|
||||||
use crate::context::RenderDocumentElement;
|
use crate::context::RenderDocumentElement;
|
||||||
use crate::context::RenderHeading;
|
|
||||||
use crate::context::RenderSection;
|
|
||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
|
|
||||||
use super::BlogPost;
|
use super::BlogPost;
|
||||||
use super::BlogPostPage;
|
use super::BlogPostPage;
|
||||||
use super::IDocumentElement;
|
|
||||||
|
|
||||||
pub(crate) fn convert_blog_post_page_to_render_context<D: AsRef<Path>, F: AsRef<Path>>(
|
pub(crate) fn convert_blog_post_page_to_render_context<D: AsRef<Path>, F: AsRef<Path>>(
|
||||||
config: &Config,
|
config: &Config,
|
||||||
@ -47,24 +44,12 @@ pub(crate) fn convert_blog_post_page_to_render_context<D: AsRef<Path>, F: AsRef<
|
|||||||
let mut children = Vec::new();
|
let mut children = Vec::new();
|
||||||
|
|
||||||
for child in page.children.iter() {
|
for child in page.children.iter() {
|
||||||
match child {
|
children.push(RenderDocumentElement::new(
|
||||||
IDocumentElement::Heading(heading) => {
|
config,
|
||||||
children.push(RenderDocumentElement::Heading(RenderHeading::new(
|
output_directory,
|
||||||
config,
|
output_file,
|
||||||
output_directory,
|
child,
|
||||||
output_file,
|
)?);
|
||||||
heading,
|
|
||||||
)?));
|
|
||||||
}
|
|
||||||
IDocumentElement::Section(section) => {
|
|
||||||
children.push(RenderDocumentElement::Section(RenderSection::new(
|
|
||||||
config,
|
|
||||||
output_directory,
|
|
||||||
output_file,
|
|
||||||
section,
|
|
||||||
)?));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
children
|
children
|
||||||
|
@ -1,8 +1,31 @@
|
|||||||
|
use crate::error::CustomError;
|
||||||
|
|
||||||
|
use super::registry::Registry;
|
||||||
use super::IHeading;
|
use super::IHeading;
|
||||||
use super::ISection;
|
use super::ISection;
|
||||||
|
use futures::future::{BoxFuture, FutureExt};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) enum IDocumentElement {
|
pub(crate) enum IDocumentElement {
|
||||||
Heading(IHeading),
|
Heading(IHeading),
|
||||||
Section(ISection),
|
Section(ISection),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl IDocumentElement {
|
||||||
|
pub(crate) fn new<'parse, 'b>(
|
||||||
|
registry: &'b mut Registry<'parse>,
|
||||||
|
original: &'b organic::types::DocumentElement<'parse>,
|
||||||
|
) -> BoxFuture<'b, Result<IDocumentElement, CustomError>> {
|
||||||
|
async move {
|
||||||
|
match original {
|
||||||
|
organic::types::DocumentElement::Heading(inner) => Ok(IDocumentElement::Heading(
|
||||||
|
IHeading::new(registry, inner).await?,
|
||||||
|
)),
|
||||||
|
organic::types::DocumentElement::Section(inner) => Ok(IDocumentElement::Section(
|
||||||
|
ISection::new(registry, inner).await?,
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.boxed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
use crate::error::CustomError;
|
use crate::error::CustomError;
|
||||||
|
|
||||||
use super::registry::Registry;
|
use super::registry::Registry;
|
||||||
|
use super::IDocumentElement;
|
||||||
use super::IObject;
|
use super::IObject;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct IHeading {
|
pub(crate) struct IHeading {
|
||||||
pub(crate) level: organic::types::HeadlineLevel,
|
pub(crate) level: organic::types::HeadlineLevel,
|
||||||
pub(crate) title: Vec<IObject>,
|
pub(crate) title: Vec<IObject>,
|
||||||
|
pub(crate) children: Vec<IDocumentElement>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IHeading {
|
impl IHeading {
|
||||||
@ -21,9 +23,17 @@ impl IHeading {
|
|||||||
}
|
}
|
||||||
ret
|
ret
|
||||||
};
|
};
|
||||||
|
let children = {
|
||||||
|
let mut ret = Vec::new();
|
||||||
|
for obj in heading.children.iter() {
|
||||||
|
ret.push(IDocumentElement::new(registry, obj).await?);
|
||||||
|
}
|
||||||
|
ret
|
||||||
|
};
|
||||||
Ok(IHeading {
|
Ok(IHeading {
|
||||||
title,
|
title,
|
||||||
level: heading.level,
|
level: heading.level,
|
||||||
|
children,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user