diff --git a/default_environment/templates/html/ast_node.dust b/default_environment/templates/html/ast_node.dust index e69de29..cb3b7a9 100644 --- a/default_environment/templates/html/ast_node.dust +++ b/default_environment/templates/html/ast_node.dust @@ -0,0 +1,57 @@ +{@select key=.type} + {@eq value="heading"}{>heading/}{/eq} + {@eq value="section"}{>section/}{/eq} + {@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} + {@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} +{! TODO: Maybe the final space should be conditional on end blank in the org source !} diff --git a/default_environment/templates/html/blog_post_page.dust b/default_environment/templates/html/blog_post_page.dust index 9ca2f8e..067b223 100644 --- a/default_environment/templates/html/blog_post_page.dust +++ b/default_environment/templates/html/blog_post_page.dust @@ -12,7 +12,10 @@ {/.children} {?.footnotes} - {>real_footnote_definition/} +

Footnotes:

+ {#.footnotes} + {>real_footnote_definition/} + {/.footnotes} {/.footnotes} diff --git a/src/context/blog_post_page.rs b/src/context/blog_post_page.rs index 9f607ce..a8720f7 100644 --- a/src/context/blog_post_page.rs +++ b/src/context/blog_post_page.rs @@ -1,5 +1,6 @@ use serde::Serialize; +use super::footnote_definition::RenderRealFootnoteDefinition; use super::GlobalSettings; use super::RenderDocumentElement; @@ -15,6 +16,8 @@ pub(crate) struct RenderBlogPostPage { self_link: Option, children: Vec, + + footnotes: Vec, } impl RenderBlogPostPage { @@ -23,12 +26,14 @@ impl RenderBlogPostPage { title: Option, self_link: Option, children: Vec, + footnotes: Vec, ) -> RenderBlogPostPage { RenderBlogPostPage { global_settings, title, self_link, children, + footnotes, } } } diff --git a/src/context/footnote_definition.rs b/src/context/footnote_definition.rs index 1734c66..877ec42 100644 --- a/src/context/footnote_definition.rs +++ b/src/context/footnote_definition.rs @@ -32,6 +32,7 @@ impl RenderFootnoteDefinition { pub(crate) struct RenderRealFootnoteDefinition { definition_id: String, reference_link: String, + label: String, contents: Vec, } @@ -53,6 +54,7 @@ impl RenderRealFootnoteDefinition { Ok(RenderRealFootnoteDefinition { definition_id: original.get_definition_id(), reference_link: format!("#{}", original.get_reference_id()), + label: original.get_display_label(), contents, }) } diff --git a/src/context/mod.rs b/src/context/mod.rs index eb6a770..129ebca 100644 --- a/src/context/mod.rs +++ b/src/context/mod.rs @@ -62,6 +62,7 @@ mod verse_block; pub(crate) use blog_post_page::RenderBlogPostPage; pub(crate) use document_element::RenderDocumentElement; pub(crate) use element::RenderElement; +pub(crate) use footnote_definition::RenderRealFootnoteDefinition; pub(crate) use global_settings::GlobalSettings; pub(crate) use heading::RenderHeading; pub(crate) use object::RenderObject; diff --git a/src/intermediate/convert.rs b/src/intermediate/convert.rs index ee9bdfa..6bdb654 100644 --- a/src/intermediate/convert.rs +++ b/src/intermediate/convert.rs @@ -6,6 +6,7 @@ use crate::config::Config; use crate::context::GlobalSettings; use crate::context::RenderBlogPostPage; use crate::context::RenderDocumentElement; +use crate::context::RenderRealFootnoteDefinition; use crate::error::CustomError; use super::BlogPost; @@ -55,11 +56,27 @@ pub(crate) fn convert_blog_post_page_to_render_context, F: AsRef< children }; + let footnotes = { + let mut ret = Vec::new(); + + for footnote in page.footnotes.iter() { + ret.push(RenderRealFootnoteDefinition::new( + config, + output_directory, + output_file, + footnote, + )?); + } + + ret + }; + let ret = RenderBlogPostPage::new( global_settings, page.title.clone(), Some(link_to_blog_post), children, + footnotes, ); Ok(ret) }