diff --git a/Cargo.lock b/Cargo.lock
index 44e485f..2d338e6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -71,6 +71,12 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
+[[package]]
+name = "autocfg"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+
[[package]]
name = "backtrace"
version = "0.3.69"
@@ -192,6 +198,95 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "gimli"
version = "0.28.0"
@@ -347,6 +442,12 @@ version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
+[[package]]
+name = "pin-utils"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+
[[package]]
name = "proc-macro2"
version = "1.0.69"
@@ -432,6 +533,15 @@ dependencies = [
"serde",
]
+[[package]]
+name = "slab"
+version = "0.4.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
+dependencies = [
+ "autocfg",
+]
+
[[package]]
name = "static_assertions"
version = "1.1.0"
@@ -641,6 +751,7 @@ version = "0.0.1"
dependencies = [
"clap",
"duster",
+ "futures",
"include_dir",
"organic",
"serde",
diff --git a/Cargo.toml b/Cargo.toml
index 4026897..d79bda7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,6 +8,7 @@ edition = "2021"
[dependencies]
clap = { version = "4.4.6", default-features = false, features = ["std", "color", "help", "derive"] }
duster = { git = "https://code.fizz.buzz/talexander/duster.git", branch = "master" }
+futures = "0.3.29"
include_dir = "0.7.3"
# TODO: This is temporary to work on the latest organic code. Eventually switch back to using the published crate.
organic = { path = "../organic" }
diff --git a/default_environment/templates/html/angle_link.dust b/default_environment/templates/html/angle_link.dust
new file mode 100644
index 0000000..b567e0a
--- /dev/null
+++ b/default_environment/templates/html/angle_link.dust
@@ -0,0 +1 @@
+angle_link
diff --git a/default_environment/templates/html/babel_call.dust b/default_environment/templates/html/babel_call.dust
new file mode 100644
index 0000000..b6166e0
--- /dev/null
+++ b/default_environment/templates/html/babel_call.dust
@@ -0,0 +1 @@
+babel_call
diff --git a/default_environment/templates/html/blog_post_page.dust b/default_environment/templates/html/blog_post_page.dust
index 6b431c4..361823b 100644
--- a/default_environment/templates/html/blog_post_page.dust
+++ b/default_environment/templates/html/blog_post_page.dust
@@ -7,5 +7,8 @@
{! TODO: Table of contents? !}
+ {#.children}
+ {>document_element/}
+ {/.children}
diff --git a/default_environment/templates/html/bold.dust b/default_environment/templates/html/bold.dust
new file mode 100644
index 0000000..1a6f4d3
--- /dev/null
+++ b/default_environment/templates/html/bold.dust
@@ -0,0 +1 @@
+bold
diff --git a/default_environment/templates/html/center_block.dust b/default_environment/templates/html/center_block.dust
new file mode 100644
index 0000000..2624d99
--- /dev/null
+++ b/default_environment/templates/html/center_block.dust
@@ -0,0 +1 @@
+center_block
diff --git a/default_environment/templates/html/citation.dust b/default_environment/templates/html/citation.dust
new file mode 100644
index 0000000..0d2030d
--- /dev/null
+++ b/default_environment/templates/html/citation.dust
@@ -0,0 +1 @@
+citation
diff --git a/default_environment/templates/html/citation_reference.dust b/default_environment/templates/html/citation_reference.dust
new file mode 100644
index 0000000..915879f
--- /dev/null
+++ b/default_environment/templates/html/citation_reference.dust
@@ -0,0 +1 @@
+citation_reference
diff --git a/default_environment/templates/html/clock.dust b/default_environment/templates/html/clock.dust
new file mode 100644
index 0000000..6c6d30d
--- /dev/null
+++ b/default_environment/templates/html/clock.dust
@@ -0,0 +1 @@
+clock
diff --git a/default_environment/templates/html/code.dust b/default_environment/templates/html/code.dust
new file mode 100644
index 0000000..01b2d72
--- /dev/null
+++ b/default_environment/templates/html/code.dust
@@ -0,0 +1 @@
+code
diff --git a/default_environment/templates/html/comment.dust b/default_environment/templates/html/comment.dust
new file mode 100644
index 0000000..60c9e47
--- /dev/null
+++ b/default_environment/templates/html/comment.dust
@@ -0,0 +1 @@
+comment
diff --git a/default_environment/templates/html/comment_block.dust b/default_environment/templates/html/comment_block.dust
new file mode 100644
index 0000000..df227b6
--- /dev/null
+++ b/default_environment/templates/html/comment_block.dust
@@ -0,0 +1 @@
+comment_block
diff --git a/default_environment/templates/html/diary_sexp.dust b/default_environment/templates/html/diary_sexp.dust
new file mode 100644
index 0000000..5951c81
--- /dev/null
+++ b/default_environment/templates/html/diary_sexp.dust
@@ -0,0 +1 @@
+diary_sexp
diff --git a/default_environment/templates/html/document_element.dust b/default_environment/templates/html/document_element.dust
new file mode 100644
index 0000000..c48b825
--- /dev/null
+++ b/default_environment/templates/html/document_element.dust
@@ -0,0 +1,5 @@
+{@select key=.type}
+ {@eq value="heading"}{>heading/}{/eq}
+ {@eq value="section"}{>section/}{/eq}
+ {@none}{!TODO: make this panic!}ERROR: Unrecognized type {.type}.{/none}
+{/select}
diff --git a/default_environment/templates/html/drawer.dust b/default_environment/templates/html/drawer.dust
new file mode 100644
index 0000000..8298313
--- /dev/null
+++ b/default_environment/templates/html/drawer.dust
@@ -0,0 +1 @@
+drawer
diff --git a/default_environment/templates/html/dynamic_block.dust b/default_environment/templates/html/dynamic_block.dust
new file mode 100644
index 0000000..ce73cdb
--- /dev/null
+++ b/default_environment/templates/html/dynamic_block.dust
@@ -0,0 +1 @@
+dynamic_block
diff --git a/default_environment/templates/html/element.dust b/default_environment/templates/html/element.dust
new file mode 100644
index 0000000..81f0ca7
--- /dev/null
+++ b/default_environment/templates/html/element.dust
@@ -0,0 +1,27 @@
+{@select key=.type}
+ {@eq value="paragraph"}{>paragraph/}{/eq}
+ {@eq value="plain_list"}{>plain_list/}{/eq}
+ {@eq value="center_block"}{>center_block/}{/eq}
+ {@eq value="quote_block"}{>quote_block/}{/eq}
+ {@eq value="special_block"}{>special_block/}{/eq}
+ {@eq value="dynamic_block"}{>dynamic_block/}{/eq}
+ {@eq value="footnote_definition"}{>footnote_definition/}{/eq}
+ {@eq value="comment"}{>comment/}{/eq}
+ {@eq value="drawer"}{>drawer/}{/eq}
+ {@eq value="property_drawer"}{>property_drawer/}{/eq}
+ {@eq value="table"}{>table/}{/eq}
+ {@eq value="verse_block"}{>verse_block/}{/eq}
+ {@eq value="comment_block"}{>comment_block/}{/eq}
+ {@eq value="example_block"}{>example_block/}{/eq}
+ {@eq value="export_block"}{>export_block/}{/eq}
+ {@eq value="src_block"}{>src_block/}{/eq}
+ {@eq value="clock"}{>clock/}{/eq}
+ {@eq value="diary_sexp"}{>diary_sexp/}{/eq}
+ {@eq value="planning"}{>planning/}{/eq}
+ {@eq value="fixed_width_area"}{>fixed_width_area/}{/eq}
+ {@eq value="horizontal_rule"}{>horizontal_rule/}{/eq}
+ {@eq value="keyword"}{>keyword/}{/eq}
+ {@eq value="babel_call"}{>babel_call/}{/eq}
+ {@eq value="latex_environment"}{>latex_environment/}{/eq}
+ {@none}{!TODO: make this panic!}ERROR: Unrecognized type {.type}.{/none}
+{/select}
diff --git a/default_environment/templates/html/entity.dust b/default_environment/templates/html/entity.dust
new file mode 100644
index 0000000..cd06bfc
--- /dev/null
+++ b/default_environment/templates/html/entity.dust
@@ -0,0 +1 @@
+entity
diff --git a/default_environment/templates/html/example_block.dust b/default_environment/templates/html/example_block.dust
new file mode 100644
index 0000000..c27860b
--- /dev/null
+++ b/default_environment/templates/html/example_block.dust
@@ -0,0 +1 @@
+example_block
diff --git a/default_environment/templates/html/export_block.dust b/default_environment/templates/html/export_block.dust
new file mode 100644
index 0000000..2963b9f
--- /dev/null
+++ b/default_environment/templates/html/export_block.dust
@@ -0,0 +1 @@
+export_block
diff --git a/default_environment/templates/html/export_snippet.dust b/default_environment/templates/html/export_snippet.dust
new file mode 100644
index 0000000..35d24d5
--- /dev/null
+++ b/default_environment/templates/html/export_snippet.dust
@@ -0,0 +1 @@
+export_snippet
diff --git a/default_environment/templates/html/fixed_width_area.dust b/default_environment/templates/html/fixed_width_area.dust
new file mode 100644
index 0000000..5136440
--- /dev/null
+++ b/default_environment/templates/html/fixed_width_area.dust
@@ -0,0 +1 @@
+fixed_width_area
diff --git a/default_environment/templates/html/footnote_definition.dust b/default_environment/templates/html/footnote_definition.dust
new file mode 100644
index 0000000..cf2b3f7
--- /dev/null
+++ b/default_environment/templates/html/footnote_definition.dust
@@ -0,0 +1 @@
+footnote_definition
diff --git a/default_environment/templates/html/footnote_reference.dust b/default_environment/templates/html/footnote_reference.dust
new file mode 100644
index 0000000..c1d73e4
--- /dev/null
+++ b/default_environment/templates/html/footnote_reference.dust
@@ -0,0 +1 @@
+footnote_reference
diff --git a/default_environment/templates/html/global_settings.dust b/default_environment/templates/html/global_settings.dust
new file mode 100644
index 0000000..ddaf22a
--- /dev/null
+++ b/default_environment/templates/html/global_settings.dust
@@ -0,0 +1 @@
+global_settings
diff --git a/default_environment/templates/html/heading.dust b/default_environment/templates/html/heading.dust
new file mode 100644
index 0000000..856846d
--- /dev/null
+++ b/default_environment/templates/html/heading.dust
@@ -0,0 +1,11 @@
+{@lte key=.level value=4}
+ {#.title}{>object/}{/.title}
+{:else}
+
+ - {#.title}{>object/}{/.title}
+
+{/lte}
+
+{#.children}
+ {>document_element/}
+{/.children}
diff --git a/default_environment/templates/html/horizontal_rule.dust b/default_environment/templates/html/horizontal_rule.dust
new file mode 100644
index 0000000..9b4969e
--- /dev/null
+++ b/default_environment/templates/html/horizontal_rule.dust
@@ -0,0 +1 @@
+horizontal_rule
diff --git a/default_environment/templates/html/inline_babel_call.dust b/default_environment/templates/html/inline_babel_call.dust
new file mode 100644
index 0000000..eefcab1
--- /dev/null
+++ b/default_environment/templates/html/inline_babel_call.dust
@@ -0,0 +1 @@
+inline_babel_call
diff --git a/default_environment/templates/html/inline_source_block.dust b/default_environment/templates/html/inline_source_block.dust
new file mode 100644
index 0000000..5f2e157
--- /dev/null
+++ b/default_environment/templates/html/inline_source_block.dust
@@ -0,0 +1 @@
+inline_source_block
diff --git a/default_environment/templates/html/italic.dust b/default_environment/templates/html/italic.dust
new file mode 100644
index 0000000..931b735
--- /dev/null
+++ b/default_environment/templates/html/italic.dust
@@ -0,0 +1 @@
+italic
diff --git a/default_environment/templates/html/keyword.dust b/default_environment/templates/html/keyword.dust
new file mode 100644
index 0000000..d37201a
--- /dev/null
+++ b/default_environment/templates/html/keyword.dust
@@ -0,0 +1 @@
+keyword
diff --git a/default_environment/templates/html/latex_environment.dust b/default_environment/templates/html/latex_environment.dust
new file mode 100644
index 0000000..12b9560
--- /dev/null
+++ b/default_environment/templates/html/latex_environment.dust
@@ -0,0 +1 @@
+latex_environment
diff --git a/default_environment/templates/html/latex_fragment.dust b/default_environment/templates/html/latex_fragment.dust
new file mode 100644
index 0000000..c611355
--- /dev/null
+++ b/default_environment/templates/html/latex_fragment.dust
@@ -0,0 +1 @@
+latex_fragment
diff --git a/default_environment/templates/html/line_break.dust b/default_environment/templates/html/line_break.dust
new file mode 100644
index 0000000..8749759
--- /dev/null
+++ b/default_environment/templates/html/line_break.dust
@@ -0,0 +1 @@
+line_break
diff --git a/default_environment/templates/html/object.dust b/default_environment/templates/html/object.dust
new file mode 100644
index 0000000..e1118aa
--- /dev/null
+++ b/default_environment/templates/html/object.dust
@@ -0,0 +1,30 @@
+{@select key=.type}
+ {@eq value="bold"}{>bold/}{/eq}
+ {@eq value="italic"}{>italic/}{/eq}
+ {@eq value="underline"}{>underline/}{/eq}
+ {@eq value="strike_through"}{>strike_through/}{/eq}
+ {@eq value="code"}{>code/}{/eq}
+ {@eq value="verbatim"}{>verbatim/}{/eq}
+ {@eq value="plain_text"}{>plain_text/}{/eq}
+ {@eq value="regular_link"}{>regular_link/}{/eq}
+ {@eq value="radio_link"}{>radio_link/}{/eq}
+ {@eq value="radio_target"}{>radio_target/}{/eq}
+ {@eq value="plain_link"}{>plain_link/}{/eq}
+ {@eq value="angle_link"}{>angle_link/}{/eq}
+ {@eq value="org_macro"}{>org_macro/}{/eq}
+ {@eq value="entity"}{>entity/}{/eq}
+ {@eq value="latex_fragment"}{>latex_fragment/}{/eq}
+ {@eq value="export_snippet"}{>export_snippet/}{/eq}
+ {@eq value="footnote_reference"}{>footnote_reference/}{/eq}
+ {@eq value="citation"}{>citation/}{/eq}
+ {@eq value="citation_reference"}{>citation_reference/}{/eq}
+ {@eq value="inline_babel_call"}{>inline_babel_call/}{/eq}
+ {@eq value="inline_source_block"}{>inline_source_block/}{/eq}
+ {@eq value="line_break"}{>line_break/}{/eq}
+ {@eq value="target"}{>target/}{/eq}
+ {@eq value="statistics_cookie"}{>statistics_cookie/}{/eq}
+ {@eq value="subscript"}{>subscript/}{/eq}
+ {@eq value="superscript"}{>superscript/}{/eq}
+ {@eq value="timestamp"}{>timestamp/}{/eq}
+ {@none}{!TODO: make this panic!}ERROR: Unrecognized type {.type}.{/none}
+{/select}
diff --git a/default_environment/templates/html/org_macro.dust b/default_environment/templates/html/org_macro.dust
new file mode 100644
index 0000000..afd230f
--- /dev/null
+++ b/default_environment/templates/html/org_macro.dust
@@ -0,0 +1 @@
+org_macro
diff --git a/default_environment/templates/html/paragraph.dust b/default_environment/templates/html/paragraph.dust
new file mode 100644
index 0000000..c7818fe
--- /dev/null
+++ b/default_environment/templates/html/paragraph.dust
@@ -0,0 +1,3 @@
+{#.children}
+ {>object/}
+{/.children}
diff --git a/default_environment/templates/html/plain_link.dust b/default_environment/templates/html/plain_link.dust
new file mode 100644
index 0000000..ecd416e
--- /dev/null
+++ b/default_environment/templates/html/plain_link.dust
@@ -0,0 +1 @@
+plain_link
diff --git a/default_environment/templates/html/plain_list.dust b/default_environment/templates/html/plain_list.dust
new file mode 100644
index 0000000..56e8975
--- /dev/null
+++ b/default_environment/templates/html/plain_list.dust
@@ -0,0 +1 @@
+plain_list
diff --git a/default_environment/templates/html/plain_text.dust b/default_environment/templates/html/plain_text.dust
new file mode 100644
index 0000000..e538e19
--- /dev/null
+++ b/default_environment/templates/html/plain_text.dust
@@ -0,0 +1 @@
+plain_text
diff --git a/default_environment/templates/html/planning.dust b/default_environment/templates/html/planning.dust
new file mode 100644
index 0000000..26310a1
--- /dev/null
+++ b/default_environment/templates/html/planning.dust
@@ -0,0 +1 @@
+planning
diff --git a/default_environment/templates/html/property_drawer.dust b/default_environment/templates/html/property_drawer.dust
new file mode 100644
index 0000000..0ab09a1
--- /dev/null
+++ b/default_environment/templates/html/property_drawer.dust
@@ -0,0 +1 @@
+property_drawer
diff --git a/default_environment/templates/html/quote_block.dust b/default_environment/templates/html/quote_block.dust
new file mode 100644
index 0000000..f3e1d19
--- /dev/null
+++ b/default_environment/templates/html/quote_block.dust
@@ -0,0 +1 @@
+quote_block
diff --git a/default_environment/templates/html/radio_link.dust b/default_environment/templates/html/radio_link.dust
new file mode 100644
index 0000000..bf05956
--- /dev/null
+++ b/default_environment/templates/html/radio_link.dust
@@ -0,0 +1 @@
+radio_link
diff --git a/default_environment/templates/html/radio_target.dust b/default_environment/templates/html/radio_target.dust
new file mode 100644
index 0000000..c0e8196
--- /dev/null
+++ b/default_environment/templates/html/radio_target.dust
@@ -0,0 +1 @@
+radio_target
diff --git a/default_environment/templates/html/regular_link.dust b/default_environment/templates/html/regular_link.dust
new file mode 100644
index 0000000..8533fae
--- /dev/null
+++ b/default_environment/templates/html/regular_link.dust
@@ -0,0 +1 @@
+regular_link
diff --git a/default_environment/templates/html/section.dust b/default_environment/templates/html/section.dust
new file mode 100644
index 0000000..7e41dd8
--- /dev/null
+++ b/default_environment/templates/html/section.dust
@@ -0,0 +1,3 @@
+{#.children}
+ {>element/}
+{/.children}
diff --git a/default_environment/templates/html/special_block.dust b/default_environment/templates/html/special_block.dust
new file mode 100644
index 0000000..83fa029
--- /dev/null
+++ b/default_environment/templates/html/special_block.dust
@@ -0,0 +1 @@
+special_block
diff --git a/default_environment/templates/html/src_block.dust b/default_environment/templates/html/src_block.dust
new file mode 100644
index 0000000..6241220
--- /dev/null
+++ b/default_environment/templates/html/src_block.dust
@@ -0,0 +1 @@
+src_block
diff --git a/default_environment/templates/html/statistics_cookie.dust b/default_environment/templates/html/statistics_cookie.dust
new file mode 100644
index 0000000..ed000db
--- /dev/null
+++ b/default_environment/templates/html/statistics_cookie.dust
@@ -0,0 +1 @@
+statistics_cookie
diff --git a/default_environment/templates/html/strike_through.dust b/default_environment/templates/html/strike_through.dust
new file mode 100644
index 0000000..5146c07
--- /dev/null
+++ b/default_environment/templates/html/strike_through.dust
@@ -0,0 +1 @@
+strike_through
diff --git a/default_environment/templates/html/subscript.dust b/default_environment/templates/html/subscript.dust
new file mode 100644
index 0000000..a7e1da3
--- /dev/null
+++ b/default_environment/templates/html/subscript.dust
@@ -0,0 +1 @@
+subscript
diff --git a/default_environment/templates/html/superscript.dust b/default_environment/templates/html/superscript.dust
new file mode 100644
index 0000000..c9b0ec3
--- /dev/null
+++ b/default_environment/templates/html/superscript.dust
@@ -0,0 +1 @@
+superscript
diff --git a/default_environment/templates/html/table.dust b/default_environment/templates/html/table.dust
new file mode 100644
index 0000000..ecbe2e6
--- /dev/null
+++ b/default_environment/templates/html/table.dust
@@ -0,0 +1 @@
+table
diff --git a/default_environment/templates/html/target.dust b/default_environment/templates/html/target.dust
new file mode 100644
index 0000000..eb5a316
--- /dev/null
+++ b/default_environment/templates/html/target.dust
@@ -0,0 +1 @@
+target
diff --git a/default_environment/templates/html/timestamp.dust b/default_environment/templates/html/timestamp.dust
new file mode 100644
index 0000000..9788f70
--- /dev/null
+++ b/default_environment/templates/html/timestamp.dust
@@ -0,0 +1 @@
+timestamp
diff --git a/default_environment/templates/html/underline.dust b/default_environment/templates/html/underline.dust
new file mode 100644
index 0000000..5d239f5
--- /dev/null
+++ b/default_environment/templates/html/underline.dust
@@ -0,0 +1 @@
+underline
diff --git a/default_environment/templates/html/verbatim.dust b/default_environment/templates/html/verbatim.dust
new file mode 100644
index 0000000..26b12cc
--- /dev/null
+++ b/default_environment/templates/html/verbatim.dust
@@ -0,0 +1 @@
+verbatim
diff --git a/default_environment/templates/html/verse_block.dust b/default_environment/templates/html/verse_block.dust
new file mode 100644
index 0000000..8e8f74c
--- /dev/null
+++ b/default_environment/templates/html/verse_block.dust
@@ -0,0 +1 @@
+verse_block
diff --git a/src/context/angle_link.rs b/src/context/angle_link.rs
index 1d97bcf..72e6df0 100644
--- a/src/context/angle_link.rs
+++ b/src/context/angle_link.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IAngleLink;
pub(crate) struct RenderAngleLink {}
impl RenderAngleLink {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IAngleLink,
) -> Result {
Ok(RenderAngleLink {})
diff --git a/src/context/babel_call.rs b/src/context/babel_call.rs
index cee5641..f8ca4fe 100644
--- a/src/context/babel_call.rs
+++ b/src/context/babel_call.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IBabelCall;
pub(crate) struct RenderBabelCall {}
impl RenderBabelCall {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IBabelCall,
) -> Result {
Ok(RenderBabelCall {})
diff --git a/src/context/bold.rs b/src/context/bold.rs
index 1d4edd7..a6158f3 100644
--- a/src/context/bold.rs
+++ b/src/context/bold.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IBold;
pub(crate) struct RenderBold {}
impl RenderBold {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IBold,
) -> Result {
Ok(RenderBold {})
diff --git a/src/context/center_block.rs b/src/context/center_block.rs
index c5e024f..c1c26d4 100644
--- a/src/context/center_block.rs
+++ b/src/context/center_block.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ICenterBlock;
pub(crate) struct RenderCenterBlock {}
impl RenderCenterBlock {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &ICenterBlock,
) -> Result {
Ok(RenderCenterBlock {})
diff --git a/src/context/citation.rs b/src/context/citation.rs
index 8e6ab3e..cea9028 100644
--- a/src/context/citation.rs
+++ b/src/context/citation.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ICitation;
pub(crate) struct RenderCitation {}
impl RenderCitation {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &ICitation,
) -> Result {
Ok(RenderCitation {})
diff --git a/src/context/citation_reference.rs b/src/context/citation_reference.rs
index e99800f..61d3d8c 100644
--- a/src/context/citation_reference.rs
+++ b/src/context/citation_reference.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ICitationReference;
pub(crate) struct RenderCitationReference {}
impl RenderCitationReference {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &ICitationReference,
) -> Result {
Ok(RenderCitationReference {})
diff --git a/src/context/clock.rs b/src/context/clock.rs
index dc32032..814db1d 100644
--- a/src/context/clock.rs
+++ b/src/context/clock.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IClock;
pub(crate) struct RenderClock {}
impl RenderClock {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IClock,
) -> Result {
Ok(RenderClock {})
diff --git a/src/context/code.rs b/src/context/code.rs
index cf90a0d..af4defe 100644
--- a/src/context/code.rs
+++ b/src/context/code.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ICode;
pub(crate) struct RenderCode {}
impl RenderCode {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &ICode,
) -> Result {
Ok(RenderCode {})
diff --git a/src/context/comment.rs b/src/context/comment.rs
index 713c220..73d94b0 100644
--- a/src/context/comment.rs
+++ b/src/context/comment.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IComment;
pub(crate) struct RenderComment {}
impl RenderComment {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IComment,
) -> Result {
Ok(RenderComment {})
diff --git a/src/context/comment_block.rs b/src/context/comment_block.rs
index d4cf314..dbe6fd4 100644
--- a/src/context/comment_block.rs
+++ b/src/context/comment_block.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ICommentBlock;
pub(crate) struct RenderCommentBlock {}
impl RenderCommentBlock {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &ICommentBlock,
) -> Result {
Ok(RenderCommentBlock {})
diff --git a/src/context/diary_sexp.rs b/src/context/diary_sexp.rs
index 8a3e5f4..0513fb6 100644
--- a/src/context/diary_sexp.rs
+++ b/src/context/diary_sexp.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IDiarySexp;
pub(crate) struct RenderDiarySexp {}
impl RenderDiarySexp {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IDiarySexp,
) -> Result {
Ok(RenderDiarySexp {})
diff --git a/src/context/document_element.rs b/src/context/document_element.rs
index 6b11e0b..f4f3283 100644
--- a/src/context/document_element.rs
+++ b/src/context/document_element.rs
@@ -1,5 +1,11 @@
+use std::path::Path;
+
use serde::Serialize;
+use crate::config::Config;
+use crate::error::CustomError;
+use crate::intermediate::IDocumentElement;
+
use super::RenderHeading;
use super::RenderSection;
@@ -9,3 +15,21 @@ pub(crate) enum RenderDocumentElement {
Heading(RenderHeading),
Section(RenderSection),
}
+
+impl RenderDocumentElement {
+ pub(crate) fn new(
+ config: &Config,
+ output_directory: &Path,
+ output_file: &Path,
+ original: &IDocumentElement,
+ ) -> Result {
+ 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)?,
+ )),
+ }
+ }
+}
diff --git a/src/context/drawer.rs b/src/context/drawer.rs
index 1872b26..fca6c58 100644
--- a/src/context/drawer.rs
+++ b/src/context/drawer.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IDrawer;
pub(crate) struct RenderDrawer {}
impl RenderDrawer {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IDrawer,
) -> Result {
Ok(RenderDrawer {})
diff --git a/src/context/dynamic_block.rs b/src/context/dynamic_block.rs
index 4535bf2..893d7c5 100644
--- a/src/context/dynamic_block.rs
+++ b/src/context/dynamic_block.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IDynamicBlock;
pub(crate) struct RenderDynamicBlock {}
impl RenderDynamicBlock {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IDynamicBlock,
) -> Result {
Ok(RenderDynamicBlock {})
diff --git a/src/context/element.rs b/src/context/element.rs
index 7d27ab6..026b812 100644
--- a/src/context/element.rs
+++ b/src/context/element.rs
@@ -61,10 +61,10 @@ pub(crate) enum RenderElement {
}
impl RenderElement {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
element: &IElement,
) -> Result {
match element {
diff --git a/src/context/entity.rs b/src/context/entity.rs
index a395ed9..f888dc5 100644
--- a/src/context/entity.rs
+++ b/src/context/entity.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IEntity;
pub(crate) struct RenderEntity {}
impl RenderEntity {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IEntity,
) -> Result {
Ok(RenderEntity {})
diff --git a/src/context/example_block.rs b/src/context/example_block.rs
index dec90ab..1d37711 100644
--- a/src/context/example_block.rs
+++ b/src/context/example_block.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IExampleBlock;
pub(crate) struct RenderExampleBlock {}
impl RenderExampleBlock {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IExampleBlock,
) -> Result {
Ok(RenderExampleBlock {})
diff --git a/src/context/export_block.rs b/src/context/export_block.rs
index bd035eb..347bffd 100644
--- a/src/context/export_block.rs
+++ b/src/context/export_block.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IExportBlock;
pub(crate) struct RenderExportBlock {}
impl RenderExportBlock {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IExportBlock,
) -> Result {
Ok(RenderExportBlock {})
diff --git a/src/context/export_snippet.rs b/src/context/export_snippet.rs
index a6fe6cc..903f7e5 100644
--- a/src/context/export_snippet.rs
+++ b/src/context/export_snippet.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IExportSnippet;
pub(crate) struct RenderExportSnippet {}
impl RenderExportSnippet {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IExportSnippet,
) -> Result {
Ok(RenderExportSnippet {})
diff --git a/src/context/fixed_width_area.rs b/src/context/fixed_width_area.rs
index e079ded..2220967 100644
--- a/src/context/fixed_width_area.rs
+++ b/src/context/fixed_width_area.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IFixedWidthArea;
pub(crate) struct RenderFixedWidthArea {}
impl RenderFixedWidthArea {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IFixedWidthArea,
) -> Result {
Ok(RenderFixedWidthArea {})
diff --git a/src/context/footnote_definition.rs b/src/context/footnote_definition.rs
index e062c28..589658e 100644
--- a/src/context/footnote_definition.rs
+++ b/src/context/footnote_definition.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IFootnoteDefinition;
pub(crate) struct RenderFootnoteDefinition {}
impl RenderFootnoteDefinition {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IFootnoteDefinition,
) -> Result {
Ok(RenderFootnoteDefinition {})
diff --git a/src/context/footnote_reference.rs b/src/context/footnote_reference.rs
index 6fbe88c..300517e 100644
--- a/src/context/footnote_reference.rs
+++ b/src/context/footnote_reference.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IFootnoteReference;
pub(crate) struct RenderFootnoteReference {}
impl RenderFootnoteReference {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IFootnoteReference,
) -> Result {
Ok(RenderFootnoteReference {})
diff --git a/src/context/heading.rs b/src/context/heading.rs
index c609c5a..ec6399f 100644
--- a/src/context/heading.rs
+++ b/src/context/heading.rs
@@ -6,6 +6,7 @@ use crate::config::Config;
use crate::error::CustomError;
use crate::intermediate::IHeading;
+use super::RenderDocumentElement;
use super::RenderObject;
#[derive(Debug, Serialize)]
@@ -14,23 +15,46 @@ use super::RenderObject;
pub(crate) struct RenderHeading {
level: organic::types::HeadlineLevel,
title: Vec,
+ children: Vec,
}
impl RenderHeading {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
heading: &IHeading,
) -> Result {
- let title = heading
- .title
- .iter()
- .map(|obj| RenderObject::new(config, &output_directory, &output_file, obj))
- .collect::, _>>()?;
+ let title = {
+ let mut ret = Vec::new();
+ for obj in heading.title.iter() {
+ ret.push(RenderObject::new(
+ 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 {
- level: heading.level,
+ level: heading.level + 1, // Adding 1 because the page title is going to be h1.
title,
+ children,
})
}
}
diff --git a/src/context/horizontal_rule.rs b/src/context/horizontal_rule.rs
index 781635e..d22316b 100644
--- a/src/context/horizontal_rule.rs
+++ b/src/context/horizontal_rule.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IHorizontalRule;
pub(crate) struct RenderHorizontalRule {}
impl RenderHorizontalRule {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IHorizontalRule,
) -> Result {
Ok(RenderHorizontalRule {})
diff --git a/src/context/inline_babel_call.rs b/src/context/inline_babel_call.rs
index cab345c..bfa5d87 100644
--- a/src/context/inline_babel_call.rs
+++ b/src/context/inline_babel_call.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IInlineBabelCall;
pub(crate) struct RenderInlineBabelCall {}
impl RenderInlineBabelCall {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IInlineBabelCall,
) -> Result {
Ok(RenderInlineBabelCall {})
diff --git a/src/context/inline_source_block.rs b/src/context/inline_source_block.rs
index 7303a8f..9972c95 100644
--- a/src/context/inline_source_block.rs
+++ b/src/context/inline_source_block.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IInlineSourceBlock;
pub(crate) struct RenderInlineSourceBlock {}
impl RenderInlineSourceBlock {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IInlineSourceBlock,
) -> Result {
Ok(RenderInlineSourceBlock {})
diff --git a/src/context/italic.rs b/src/context/italic.rs
index 7f3bf4c..7aa1557 100644
--- a/src/context/italic.rs
+++ b/src/context/italic.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IItalic;
pub(crate) struct RenderItalic {}
impl RenderItalic {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IItalic,
) -> Result {
Ok(RenderItalic {})
diff --git a/src/context/keyword.rs b/src/context/keyword.rs
index c9e7a10..99dc1c7 100644
--- a/src/context/keyword.rs
+++ b/src/context/keyword.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IKeyword;
pub(crate) struct RenderKeyword {}
impl RenderKeyword {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
keyword: &IKeyword,
) -> Result {
Ok(RenderKeyword {})
diff --git a/src/context/latex_environment.rs b/src/context/latex_environment.rs
index b7b75ae..74fe81d 100644
--- a/src/context/latex_environment.rs
+++ b/src/context/latex_environment.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ILatexEnvironment;
pub(crate) struct RenderLatexEnvironment {}
impl RenderLatexEnvironment {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &ILatexEnvironment,
) -> Result {
Ok(RenderLatexEnvironment {})
diff --git a/src/context/latex_fragment.rs b/src/context/latex_fragment.rs
index 69fdb94..58ddddf 100644
--- a/src/context/latex_fragment.rs
+++ b/src/context/latex_fragment.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ILatexFragment;
pub(crate) struct RenderLatexFragment {}
impl RenderLatexFragment {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &ILatexFragment,
) -> Result {
Ok(RenderLatexFragment {})
diff --git a/src/context/line_break.rs b/src/context/line_break.rs
index 68394da..d804926 100644
--- a/src/context/line_break.rs
+++ b/src/context/line_break.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ILineBreak;
pub(crate) struct RenderLineBreak {}
impl RenderLineBreak {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &ILineBreak,
) -> Result {
Ok(RenderLineBreak {})
diff --git a/src/context/object.rs b/src/context/object.rs
index 63e65d1..931b25e 100644
--- a/src/context/object.rs
+++ b/src/context/object.rs
@@ -67,10 +67,10 @@ pub(crate) enum RenderObject {
}
impl RenderObject {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
object: &IObject,
) -> Result {
match object {
diff --git a/src/context/org_macro.rs b/src/context/org_macro.rs
index 87c144b..abcdb83 100644
--- a/src/context/org_macro.rs
+++ b/src/context/org_macro.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IOrgMacro;
pub(crate) struct RenderOrgMacro {}
impl RenderOrgMacro {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IOrgMacro,
) -> Result {
Ok(RenderOrgMacro {})
diff --git a/src/context/paragraph.rs b/src/context/paragraph.rs
index 2570f93..2e0e1c3 100644
--- a/src/context/paragraph.rs
+++ b/src/context/paragraph.rs
@@ -16,17 +16,25 @@ pub(crate) struct RenderParagraph {
}
impl RenderParagraph {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
paragraph: &IParagraph,
) -> Result {
- let children = paragraph
- .children
- .iter()
- .map(|obj| RenderObject::new(config, &output_directory, &output_file, obj))
- .collect::, _>>()?;
+ let children = {
+ let mut ret = Vec::new();
+ for obj in paragraph.children.iter() {
+ ret.push(RenderObject::new(
+ config,
+ &output_directory,
+ &output_file,
+ obj,
+ )?);
+ }
+ ret
+ };
+
Ok(RenderParagraph { children })
}
}
diff --git a/src/context/plain_link.rs b/src/context/plain_link.rs
index 9951f5a..a0c6606 100644
--- a/src/context/plain_link.rs
+++ b/src/context/plain_link.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IPlainLink;
pub(crate) struct RenderPlainLink {}
impl RenderPlainLink {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IPlainLink,
) -> Result {
Ok(RenderPlainLink {})
diff --git a/src/context/plain_list.rs b/src/context/plain_list.rs
index 746d222..8c239f4 100644
--- a/src/context/plain_list.rs
+++ b/src/context/plain_list.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IPlainList;
pub(crate) struct RenderPlainList {}
impl RenderPlainList {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IPlainList,
) -> Result {
Ok(RenderPlainList {})
diff --git a/src/context/plain_text.rs b/src/context/plain_text.rs
index 76f3d78..12b9e79 100644
--- a/src/context/plain_text.rs
+++ b/src/context/plain_text.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IPlainText;
pub(crate) struct RenderPlainText {}
impl RenderPlainText {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
heading: &IPlainText,
) -> Result {
Ok(RenderPlainText {})
diff --git a/src/context/planning.rs b/src/context/planning.rs
index 1086dc2..7be554c 100644
--- a/src/context/planning.rs
+++ b/src/context/planning.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IPlanning;
pub(crate) struct RenderPlanning {}
impl RenderPlanning {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IPlanning,
) -> Result {
Ok(RenderPlanning {})
diff --git a/src/context/property_drawer.rs b/src/context/property_drawer.rs
index d85c72b..8e1bc6f 100644
--- a/src/context/property_drawer.rs
+++ b/src/context/property_drawer.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IPropertyDrawer;
pub(crate) struct RenderPropertyDrawer {}
impl RenderPropertyDrawer {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IPropertyDrawer,
) -> Result {
Ok(RenderPropertyDrawer {})
diff --git a/src/context/quote_block.rs b/src/context/quote_block.rs
index 6de04e0..9603f44 100644
--- a/src/context/quote_block.rs
+++ b/src/context/quote_block.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IQuoteBlock;
pub(crate) struct RenderQuoteBlock {}
impl RenderQuoteBlock {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IQuoteBlock,
) -> Result {
Ok(RenderQuoteBlock {})
diff --git a/src/context/radio_link.rs b/src/context/radio_link.rs
index 6001f51..2c41bfd 100644
--- a/src/context/radio_link.rs
+++ b/src/context/radio_link.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IRadioLink;
pub(crate) struct RenderRadioLink {}
impl RenderRadioLink {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IRadioLink,
) -> Result {
Ok(RenderRadioLink {})
diff --git a/src/context/radio_target.rs b/src/context/radio_target.rs
index b56a020..7be7452 100644
--- a/src/context/radio_target.rs
+++ b/src/context/radio_target.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IRadioTarget;
pub(crate) struct RenderRadioTarget {}
impl RenderRadioTarget {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IRadioTarget,
) -> Result {
Ok(RenderRadioTarget {})
diff --git a/src/context/regular_link.rs b/src/context/regular_link.rs
index 6727714..38bae6b 100644
--- a/src/context/regular_link.rs
+++ b/src/context/regular_link.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IRegularLink;
pub(crate) struct RenderRegularLink {}
impl RenderRegularLink {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IRegularLink,
) -> Result {
Ok(RenderRegularLink {})
diff --git a/src/context/section.rs b/src/context/section.rs
index d614638..45d66bf 100644
--- a/src/context/section.rs
+++ b/src/context/section.rs
@@ -16,17 +16,24 @@ pub(crate) struct RenderSection {
}
impl RenderSection {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
section: &ISection,
) -> Result {
- let children = section
- .children
- .iter()
- .map(|obj| RenderElement::new(config, &output_directory, &output_file, obj))
- .collect::, _>>()?;
+ let children = {
+ let mut ret = Vec::new();
+ for obj in section.children.iter() {
+ ret.push(RenderElement::new(
+ config,
+ &output_directory,
+ &output_file,
+ obj,
+ )?);
+ }
+ ret
+ };
Ok(RenderSection { children })
}
diff --git a/src/context/special_block.rs b/src/context/special_block.rs
index b8906ff..085be8b 100644
--- a/src/context/special_block.rs
+++ b/src/context/special_block.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ISpecialBlock;
pub(crate) struct RenderSpecialBlock {}
impl RenderSpecialBlock {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &ISpecialBlock,
) -> Result {
Ok(RenderSpecialBlock {})
diff --git a/src/context/src_block.rs b/src/context/src_block.rs
index cdbf0ec..0c19570 100644
--- a/src/context/src_block.rs
+++ b/src/context/src_block.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ISrcBlock;
pub(crate) struct RenderSrcBlock {}
impl RenderSrcBlock {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &ISrcBlock,
) -> Result {
Ok(RenderSrcBlock {})
diff --git a/src/context/statistics_cookie.rs b/src/context/statistics_cookie.rs
index 774f1f3..33ff1fa 100644
--- a/src/context/statistics_cookie.rs
+++ b/src/context/statistics_cookie.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IStatisticsCookie;
pub(crate) struct RenderStatisticsCookie {}
impl RenderStatisticsCookie {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IStatisticsCookie,
) -> Result {
Ok(RenderStatisticsCookie {})
diff --git a/src/context/strike_through.rs b/src/context/strike_through.rs
index 2f0249f..22b4269 100644
--- a/src/context/strike_through.rs
+++ b/src/context/strike_through.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IStrikeThrough;
pub(crate) struct RenderStrikeThrough {}
impl RenderStrikeThrough {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IStrikeThrough,
) -> Result {
Ok(RenderStrikeThrough {})
diff --git a/src/context/subscript.rs b/src/context/subscript.rs
index dd31b29..78596ad 100644
--- a/src/context/subscript.rs
+++ b/src/context/subscript.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ISubscript;
pub(crate) struct RenderSubscript {}
impl RenderSubscript {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &ISubscript,
) -> Result {
Ok(RenderSubscript {})
diff --git a/src/context/superscript.rs b/src/context/superscript.rs
index f47fac7..99b07bb 100644
--- a/src/context/superscript.rs
+++ b/src/context/superscript.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ISuperscript;
pub(crate) struct RenderSuperscript {}
impl RenderSuperscript {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &ISuperscript,
) -> Result {
Ok(RenderSuperscript {})
diff --git a/src/context/table.rs b/src/context/table.rs
index b80c216..9d067bd 100644
--- a/src/context/table.rs
+++ b/src/context/table.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ITable;
pub(crate) struct RenderTable {}
impl RenderTable {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &ITable,
) -> Result {
Ok(RenderTable {})
diff --git a/src/context/target.rs b/src/context/target.rs
index ebdb69c..22f8aec 100644
--- a/src/context/target.rs
+++ b/src/context/target.rs
@@ -14,10 +14,10 @@ pub(crate) struct RenderTarget {
}
impl RenderTarget {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
target: &ITarget,
) -> Result {
Ok(RenderTarget {
diff --git a/src/context/timestamp.rs b/src/context/timestamp.rs
index fa1daa3..bc28ef5 100644
--- a/src/context/timestamp.rs
+++ b/src/context/timestamp.rs
@@ -12,10 +12,10 @@ use crate::intermediate::ITimestamp;
pub(crate) struct RenderTimestamp {}
impl RenderTimestamp {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &ITimestamp,
) -> Result {
Ok(RenderTimestamp {})
diff --git a/src/context/underline.rs b/src/context/underline.rs
index 4575881..05ed24e 100644
--- a/src/context/underline.rs
+++ b/src/context/underline.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IUnderline;
pub(crate) struct RenderUnderline {}
impl RenderUnderline {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IUnderline,
) -> Result {
Ok(RenderUnderline {})
diff --git a/src/context/verbatim.rs b/src/context/verbatim.rs
index 2523c83..a0f6262 100644
--- a/src/context/verbatim.rs
+++ b/src/context/verbatim.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IVerbatim;
pub(crate) struct RenderVerbatim {}
impl RenderVerbatim {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
comment: &IVerbatim,
) -> Result {
Ok(RenderVerbatim {})
diff --git a/src/context/verse_block.rs b/src/context/verse_block.rs
index bc14724..a667cab 100644
--- a/src/context/verse_block.rs
+++ b/src/context/verse_block.rs
@@ -12,10 +12,10 @@ use crate::intermediate::IVerseBlock;
pub(crate) struct RenderVerseBlock {}
impl RenderVerseBlock {
- pub(crate) fn new, F: AsRef>(
+ pub(crate) fn new(
config: &Config,
- output_directory: D,
- output_file: F,
+ output_directory: &Path,
+ output_file: &Path,
original: &IVerseBlock,
) -> Result {
Ok(RenderVerseBlock {})
diff --git a/src/intermediate/convert.rs b/src/intermediate/convert.rs
index f28ac59..ee9bdfa 100644
--- a/src/intermediate/convert.rs
+++ b/src/intermediate/convert.rs
@@ -6,13 +6,10 @@ use crate::config::Config;
use crate::context::GlobalSettings;
use crate::context::RenderBlogPostPage;
use crate::context::RenderDocumentElement;
-use crate::context::RenderHeading;
-use crate::context::RenderSection;
use crate::error::CustomError;
use super::BlogPost;
use super::BlogPostPage;
-use super::IDocumentElement;
pub(crate) fn convert_blog_post_page_to_render_context, F: AsRef>(
config: &Config,
@@ -47,24 +44,12 @@ pub(crate) fn convert_blog_post_page_to_render_context, F: AsRef<
let mut children = Vec::new();
for child in page.children.iter() {
- match child {
- IDocumentElement::Heading(heading) => {
- children.push(RenderDocumentElement::Heading(RenderHeading::new(
- config,
- output_directory,
- output_file,
- heading,
- )?));
- }
- IDocumentElement::Section(section) => {
- children.push(RenderDocumentElement::Section(RenderSection::new(
- config,
- output_directory,
- output_file,
- section,
- )?));
- }
- }
+ children.push(RenderDocumentElement::new(
+ config,
+ output_directory,
+ output_file,
+ child,
+ )?);
}
children
diff --git a/src/intermediate/document_element.rs b/src/intermediate/document_element.rs
index 3f35270..d348269 100644
--- a/src/intermediate/document_element.rs
+++ b/src/intermediate/document_element.rs
@@ -1,8 +1,31 @@
+use crate::error::CustomError;
+
+use super::registry::Registry;
use super::IHeading;
use super::ISection;
+use futures::future::{BoxFuture, FutureExt};
#[derive(Debug)]
pub(crate) enum IDocumentElement {
Heading(IHeading),
Section(ISection),
}
+
+impl IDocumentElement {
+ pub(crate) fn new<'parse, 'b>(
+ registry: &'b mut Registry<'parse>,
+ original: &'b organic::types::DocumentElement<'parse>,
+ ) -> BoxFuture<'b, Result> {
+ 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()
+ }
+}
diff --git a/src/intermediate/heading.rs b/src/intermediate/heading.rs
index 17cc680..4ed510e 100644
--- a/src/intermediate/heading.rs
+++ b/src/intermediate/heading.rs
@@ -1,12 +1,14 @@
use crate::error::CustomError;
use super::registry::Registry;
+use super::IDocumentElement;
use super::IObject;
#[derive(Debug)]
pub(crate) struct IHeading {
pub(crate) level: organic::types::HeadlineLevel,
pub(crate) title: Vec,
+ pub(crate) children: Vec,
}
impl IHeading {
@@ -21,9 +23,17 @@ impl IHeading {
}
ret
};
+ let children = {
+ let mut ret = Vec::new();
+ for obj in heading.children.iter() {
+ ret.push(IDocumentElement::new(registry, obj).await?);
+ }
+ ret
+ };
Ok(IHeading {
title,
level: heading.level,
+ children,
})
}
}