Compare commits

...

23 Commits

Author SHA1 Message Date
Tom Alexander
d641c8d638
Merge branch 'pretty' 2023-12-21 18:36:23 -05:00
Tom Alexander
7e2fd70212
Style the homepage. 2023-12-21 18:34:42 -05:00
Tom Alexander
4fb08bc7d0
Wrap inline footnote definitions in a paragraph tag.
This is to match the behavior of the upstream org html exporter.
2023-12-21 18:09:43 -05:00
Tom Alexander
01b55b7256
Make paragraphs under footnote definitions display inline.
This seems to be the behavior of the upstream org html exporter.
2023-12-21 17:44:40 -05:00
Tom Alexander
bd68681e44
Increase the size of headlines.
This is to make them stand out more from the regular text.
2023-12-21 17:31:19 -05:00
Tom Alexander
27ff13e675
Also special-case plain list items containing only paragraphs and sublists.
This seems to be the behavior of the upstream org html exporter.
2023-12-21 17:27:19 -05:00
Tom Alexander
2914e42ba1
For plain list items with a single child that is a paragraph, do not wrap in paragraph html tags.
This is mimicking the behavior from org-mode's HTML exporter.
2023-12-21 17:18:51 -05:00
Tom Alexander
a8969f141d
Style code and verbatim. 2023-12-21 16:49:44 -05:00
Tom Alexander
6f049e00d4
Style inline source blocks. 2023-12-21 16:42:22 -05:00
Tom Alexander
45a1076d18
Style descriptive plain lists. 2023-12-21 16:39:26 -05:00
Tom Alexander
775c88d67a
Style footnotes. 2023-12-21 15:44:56 -05:00
Tom Alexander
efbf6cfc0c
Style ordered and unordered plain lists. 2023-12-21 15:31:13 -05:00
Tom Alexander
5af4a372ae
Make object trailing space dependent on post_blank. 2023-12-21 15:13:07 -05:00
Tom Alexander
72952adb6b
Add post_blank to the rust types. 2023-12-21 15:09:13 -05:00
Tom Alexander
8b85c02ef1
Wrap the intermediate Registry in an IntermediateContext.
This is currently just to maintain consistency with the render phase's RenderContext but in the future it should allow us to include immutable data that is not locked behind the ArcMutex.
2023-12-21 13:53:56 -05:00
Tom Alexander
2ae4839ce0
Remove common whitespace prefix from src block lines. 2023-12-21 13:16:05 -05:00
Tom Alexander
5654c40d03
Get the real language for src blocks from the org source. 2023-12-21 12:07:36 -05:00
Tom Alexander
b538750287
Preserve whitespace in src blocks. 2023-12-21 12:04:29 -05:00
Tom Alexander
65ed754bfe
Space out some elements. 2023-12-19 21:57:33 -05:00
Tom Alexander
80cdf5166b
Style quote blocks, h2, and h3. 2023-12-19 21:41:41 -05:00
Tom Alexander
3968121d54
Style src blocks. 2023-12-19 21:30:59 -05:00
Tom Alexander
a29b625631
Apply a dark background. 2023-12-19 20:33:21 -05:00
Tom Alexander
e193fcc2ba
Start applying styles to blog posts. 2023-12-19 19:23:56 -05:00
141 changed files with 991 additions and 375 deletions

View File

@ -0,0 +1,187 @@
:root {
--main-max-width: 800px;
--site-background-color: #0a0a0a;
--site-text-color: #fffffc;
--header-divider-color: #6a687a;
--stream-divider-color: #6ccff6;
--src-font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
--src-block-background-color: #141414;
--src-block-border-color: #84828f;
--src-block-language-color: #0a0a0a;
--src-block-language-background: #84828f;
--quote-block-border-color: #84828f;
}
body {
color: var(--site-text-color);
background-color: var(--site-background-color);
font-family: source-sans-pro, Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', sans-serif;
a:link, a:visited {
/* TODO: Should I use a different color for links? */
color: var(--site-text-color);
}
}
.page_centering {
display: flex;
flex-direction: column;
align-items: center;
}
.page_header {
width: 100%;
max-width: var(--main-max-width);
border-bottom: 0.1rem solid var(--header-divider-color);
.home_link {
font-size: 1.2rem;
font-weight: 600;
text-decoration: none;
&:link, &:visited {
color: var(--site-text-color);
}
}
}
.main_content {
width: 100%;
max-width: var(--main-max-width);
font-size: 1.2rem;
line-height: 1.2;
/* A stand-alone blog post (not in a blog stream). */
.blog_post {
padding: 1rem 0 3rem 0;
}
.blog_stream {
.stream_divider {
color: var(--stream-divider-color);
}
}
/* A blog post in a blog stream (for example, the homepage). */
.blog_stream_post {
background: #1F1F1F;
padding: 1rem 0.2rem;
}
.blog_post_title {
font-size: 2.5rem;
font-weight: 700;
padding-bottom: 1rem;
}
p {
margin: 1rem 0;
}
.src_block {
background: var(--src-block-background-color);
border-radius: 3px;
border: 1px solid var(--src-block-border-color);
font-size: 1rem;
font-family: var(--src-font-family);
margin: 1rem 0;
.src_language {
display: inline-block;
color: var(--src-block-language-color);
background: var(--src-block-language-background);
border-radius: 0 0 3px 0;
padding: 0.1rem 0.5rem;
font-size: 0.8rem;
vertical-align: top;
}
.src_body {
margin: 0.5rem;
.src_line {
white-space: pre-wrap;
}
}
}
.inline_source_block {
font-family: var(--src-font-family);
font-size: 1rem;
}
.code, .verbatim {
font-family: var(--src-font-family);
font-size: 1rem;
}
.quote_block {
border-left: 1px solid var(--quote-block-border-color);
padding: 0 0 0 1rem;
margin: 1rem 0 1rem 2rem;
}
h2, h3 {
margin: 1rem 0;
padding-bottom: 0.5rem;
}
h2 {
font-size: 2.3rem;
font-weight: 600;
}
h3 {
font-size: 2.1rem;
font-weight: 600;
}
.plain_list {
&.unordered {
list-style-type: disc;
padding-left: 2.5rem;
}
&.ordered {
list-style-type: decimal;
padding-left: 2.5rem;
}
&.descriptive {
font-size: 1rem;
> dt {
font-weight: 600;
}
> dd {
padding-left: 2.5rem;
}
}
}
.footnote_reference {
vertical-align: super;
font-size: 80%;
> a {
text-decoration: none;
}
}
.footnote_definition {
.label {
text-decoration: none;
}
.definition {
display: inline;
> p {
display: inline;
}
}
}
}

View File

@ -1,8 +1,6 @@
<div class="blog_post">
<div class="blog_post_intro">
{?.title}{?.self_link}<a class="blog_post_title" href="{.self_link}">{.title}</a>{:else}<div class="blog_post_title">{.title}</div>{/.self_link}{/.title}
{! TODO: date? !}
</div>
<article class="blog_post">
{?.title}<h1 class="blog_post_title"><span>{.title}</span></h1>{/.title}
{! TODO: date? !}
{! TODO: Table of contents? !}
@ -18,4 +16,4 @@
{/.footnotes}
{/.footnotes}
</div>
</div>
</article>

View File

@ -1,5 +1,6 @@
<div class="blog_stream">
{#.children}
{@gt key=$idx value=0}<hr class="stream_divider" />{/gt}
<div class="blog_stream_post">
<div class="blog_post_intro">
{?.title}{?.self_link}<a class="blog_post_title" href="{.self_link}">{.title}</a>{:else}<div class="blog_post_title">{.title}</div>{/.self_link}{/.title}

View File

@ -1 +1 @@
<code>{.contents}</code>
<code class="code">{.contents}</code>

View File

@ -1,6 +1,7 @@
{@select key=.type}
{@eq value="paragraph"}{>paragraph/}{/eq}
{@eq value="plain_list"}{>plain_list/}{/eq}
{@eq value="plain_list_simple_item"}{>plain_list_simple_item/}{/eq}
{@eq value="center_block"}{>center_block/}{/eq}
{@eq value="quote_block"}{>quote_block/}{/eq}
{@eq value="special_block"}{>special_block/}{/eq}

View File

@ -1 +1 @@
<sup><a id="{.reference_id}" href="{.definition_link}">{.label}</a></sup>
<sup class="footnote_reference"><a id="{.reference_id}" href="{.definition_link}">{.label}</a></sup>

View File

@ -1 +1 @@
<code>{.value}</code>
<code class="inline_source_block">{.value}</code>

View File

@ -6,14 +6,14 @@
{#global_settings.js_files}<script type="text/javascript" src="{.}"></script>{/global_settings.js_files}
{?global_settings.page_title}<title>{global_settings.page_title}</title>{/global_settings.page_title}
</head>
<body>
<body class="page_centering">
{#.page_header}{>page_header/}{/.page_header}
<div class="main_content">
<main class="main_content">
{@select key=.type}
{@eq value="blog_post_page"}{>blog_post_page/}{/eq}
{@eq value="blog_stream"}{>blog_stream/}{/eq}
{@none}{!TODO: make this panic!}ERROR: Unrecognized page content type{/none}
{/select}
</div>
</main>
</body>
</html>

View File

@ -27,5 +27,4 @@
{@eq value="superscript"}{>superscript/}{/eq}
{@eq value="timestamp"}{>timestamp/}{/eq}
{@none}{!TODO: make this panic!}ERROR: Unrecognized type {.type}.{/none}
{/select}{~s}
{! TODO: Maybe the final space should be conditional on end blank in the org source !}
{/select}{@gt key=.post_blank value=0}{~s}{/gt}

View File

@ -1,4 +1,4 @@
<div class="page_header">
<a href="{.home_link}">{.website_title}</a>
{! TODO: Additional links? !}
</div>
<header class="page_header">
<a class="home_link" href="{.home_link}">{.website_title}</a>
{! TODO: Additional links? Probably using the nav semantic element. !}
</header>

View File

@ -1,6 +1,6 @@
{@select key=.list_type}
{@eq value="unordered"}<ul>{#.children}{>plain_list_item/}{/.children}</ul>{/eq}
{@eq value="ordered"}<ol>{#.children}{>plain_list_item/}{/.children}</ol>{/eq}
{@eq value="descriptive"}<dl>{#.children}{>plain_list_item/}{/.children}</dl>{/eq}
{@eq value="unordered"}<ul class="plain_list unordered">{#.children}{>plain_list_item/}{/.children}</ul>{/eq}
{@eq value="ordered"}<ol class="plain_list ordered">{#.children}{>plain_list_item/}{/.children}</ol>{/eq}
{@eq value="descriptive"}<dl class="plain_list descriptive">{#.children}{>plain_list_item/}{/.children}</dl>{/eq}
{@none}{!TODO: make this panic!}ERROR: Unrecognized list type {.list_type}.{/none}
{/select}

View File

@ -0,0 +1,3 @@
{#.children}
{>object/}
{/.children}

View File

@ -1,3 +1,3 @@
<blockquote>{#.children}
<blockquote class="quote_block">{#.children}
{>element/}
{/.children}</blockquote>

View File

@ -1 +1 @@
<div><sup><a id="{.definition_id}" href="{.reference_link}">{.label}</a></sup><div>{#.contents}{>ast_node/}{/.contents}</div></div>
<div class="footnote_definition"><a id="{.definition_id}" href="{.reference_link}" class="label">{.label}.</a> <div class="definition">{#.contents}{>ast_node/}{/.contents}</div></div>

View File

@ -1,9 +1,12 @@
<table>
<tbody>
{#.lines}
<tr>
<td><code>{.}</code></td>
</tr>
{/.lines}
</tbody>
</table>
<div class="src_block">
{?.language}<div class="src_language">{.language}</div>{/.language}
<table class="src_body">
<tbody>
{#.lines}
<tr>
<td><code class="src_line">{.}</code></td>
</tr>
{/.lines}
</tbody>
</table>
</div>

View File

@ -1 +1 @@
<code>{.contents}</code>
<code class="verbatim">{.contents}</code>

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "angle_link")]
pub(crate) struct RenderAngleLink {}
pub(crate) struct RenderAngleLink {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderAngleLink, IAngleLink);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "babel_call")]
pub(crate) struct RenderBabelCall {}
pub(crate) struct RenderBabelCall {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderBabelCall, IBabelCall);

View File

@ -12,6 +12,7 @@ use super::RenderObject;
#[serde(rename = "bold")]
pub(crate) struct RenderBold {
children: Vec<RenderObject>,
post_blank: organic::types::PostBlank,
}
render!(RenderBold, IBold, original, render_context, {
@ -23,5 +24,8 @@ render!(RenderBold, IBold, original, render_context, {
ret
};
Ok(RenderBold { children })
Ok(RenderBold {
children,
post_blank: original.post_blank,
})
});

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "center_block")]
pub(crate) struct RenderCenterBlock {}
pub(crate) struct RenderCenterBlock {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderCenterBlock, ICenterBlock);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "citation")]
pub(crate) struct RenderCitation {}
pub(crate) struct RenderCitation {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderCitation, ICitation);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "citation_reference")]
pub(crate) struct RenderCitationReference {}
pub(crate) struct RenderCitationReference {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderCitationReference, ICitationReference);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "clock")]
pub(crate) struct RenderClock {}
pub(crate) struct RenderClock {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderClock, IClock);

View File

@ -11,10 +11,12 @@ use super::macros::render;
#[serde(rename = "code")]
pub(crate) struct RenderCode {
contents: String,
post_blank: organic::types::PostBlank,
}
render!(RenderCode, ICode, original, _render_context, {
Ok(RenderCode {
contents: original.contents.clone(),
post_blank: original.post_blank,
})
});

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "comment")]
pub(crate) struct RenderComment {}
pub(crate) struct RenderComment {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderComment, IComment);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "comment_block")]
pub(crate) struct RenderCommentBlock {}
pub(crate) struct RenderCommentBlock {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderCommentBlock, ICommentBlock);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "diary_sexp")]
pub(crate) struct RenderDiarySexp {}
pub(crate) struct RenderDiarySexp {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderDiarySexp, IDiarySexp);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "drawer")]
pub(crate) struct RenderDrawer {}
pub(crate) struct RenderDrawer {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderDrawer, IDrawer);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "dynamic_block")]
pub(crate) struct RenderDynamicBlock {}
pub(crate) struct RenderDynamicBlock {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderDynamicBlock, IDynamicBlock);

View File

@ -1,5 +1,6 @@
use serde::Serialize;
use super::plain_list_simple_item::RenderPlainListSimpleItem;
use super::render_context::RenderContext;
use crate::error::CustomError;
use crate::intermediate::IElement;
@ -35,6 +36,7 @@ use super::verse_block::RenderVerseBlock;
pub(crate) enum RenderElement {
Paragraph(RenderParagraph),
PlainList(RenderPlainList),
PlainListSimpleItem(RenderPlainListSimpleItem),
CenterBlock(RenderCenterBlock),
QuoteBlock(RenderQuoteBlock),
SpecialBlock(RenderSpecialBlock),
@ -69,6 +71,9 @@ render!(RenderElement, IElement, original, render_context, {
render_context.clone(),
inner,
)?)),
IElement::PlainListSimpleItem(inner) => Ok(RenderElement::PlainListSimpleItem(
RenderPlainListSimpleItem::new(render_context.clone(), inner)?,
)),
IElement::CenterBlock(inner) => Ok(RenderElement::CenterBlock(RenderCenterBlock::new(
render_context.clone(),
inner,

View File

@ -11,10 +11,12 @@ use super::macros::render;
#[serde(rename = "entity")]
pub(crate) struct RenderEntity {
html: String,
post_blank: organic::types::PostBlank,
}
render!(RenderEntity, IEntity, original, _render_context, {
Ok(RenderEntity {
html: original.html.clone(),
post_blank: original.post_blank,
})
});

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "example_block")]
pub(crate) struct RenderExampleBlock {}
pub(crate) struct RenderExampleBlock {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderExampleBlock, IExampleBlock);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "export_block")]
pub(crate) struct RenderExportBlock {}
pub(crate) struct RenderExportBlock {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderExportBlock, IExportBlock);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "export_snippet")]
pub(crate) struct RenderExportSnippet {}
pub(crate) struct RenderExportSnippet {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderExportSnippet, IExportSnippet);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "fixed_width_area")]
pub(crate) struct RenderFixedWidthArea {}
pub(crate) struct RenderFixedWidthArea {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderFixedWidthArea, IFixedWidthArea);

View File

@ -13,18 +13,21 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "footnote_definition")]
pub(crate) struct RenderFootnoteDefinition {}
pub(crate) struct RenderFootnoteDefinition {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderFootnoteDefinition, IFootnoteDefinition);
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "footnote_reference")]
#[serde(rename = "real_footnote_definition")]
pub(crate) struct RenderRealFootnoteDefinition {
definition_id: String,
reference_link: String,
label: String,
contents: Vec<RenderAstNode>,
// TODO: Do I need post_blank for real footnote definitions?
}
render!(

View File

@ -13,6 +13,7 @@ pub(crate) struct RenderFootnoteReference {
reference_id: String,
definition_link: String,
label: String,
post_blank: organic::types::PostBlank,
}
render!(
@ -28,6 +29,7 @@ render!(
original.get_definition_id(render_context.id_addition)
),
label: original.get_display_label(),
post_blank: original.post_blank,
})
}
);

View File

@ -15,6 +15,7 @@ pub(crate) struct RenderHeading {
level: organic::types::HeadlineLevel,
title: Vec<RenderObject>,
children: Vec<RenderDocumentElement>,
post_blank: organic::types::PostBlank,
}
render!(RenderHeading, IHeading, original, render_context, {
@ -38,5 +39,6 @@ render!(RenderHeading, IHeading, original, render_context, {
level: original.level + 1, // Adding 1 because the page title is going to be h1.
title,
children,
post_blank: original.post_blank,
})
});

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "horizontal_rule")]
pub(crate) struct RenderHorizontalRule {}
pub(crate) struct RenderHorizontalRule {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderHorizontalRule, IHorizontalRule);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "inline_babel_call")]
pub(crate) struct RenderInlineBabelCall {}
pub(crate) struct RenderInlineBabelCall {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderInlineBabelCall, IInlineBabelCall);

View File

@ -11,6 +11,7 @@ use super::macros::render;
#[serde(rename = "inline_source_block")]
pub(crate) struct RenderInlineSourceBlock {
value: String,
post_blank: organic::types::PostBlank,
}
render!(
@ -21,6 +22,7 @@ render!(
{
Ok(RenderInlineSourceBlock {
value: original.value.clone(),
post_blank: original.post_blank,
})
}
);

View File

@ -12,6 +12,7 @@ use super::RenderObject;
#[serde(rename = "italic")]
pub(crate) struct RenderItalic {
children: Vec<RenderObject>,
post_blank: organic::types::PostBlank,
}
render!(RenderItalic, IItalic, original, render_context, {
@ -23,5 +24,8 @@ render!(RenderItalic, IItalic, original, render_context, {
ret
};
Ok(RenderItalic { children })
Ok(RenderItalic {
children,
post_blank: original.post_blank,
})
});

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "keyword")]
pub(crate) struct RenderKeyword {}
pub(crate) struct RenderKeyword {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderKeyword, IKeyword);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "latex_environment")]
pub(crate) struct RenderLatexEnvironment {}
pub(crate) struct RenderLatexEnvironment {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderLatexEnvironment, ILatexEnvironment);

View File

@ -11,6 +11,7 @@ use super::macros::render;
#[serde(rename = "latex_fragment")]
pub(crate) struct RenderLatexFragment {
value: String,
post_blank: organic::types::PostBlank,
}
render!(
@ -21,6 +22,7 @@ render!(
{
Ok(RenderLatexFragment {
value: original.value.clone(),
post_blank: original.post_blank,
})
}
);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "line_break")]
pub(crate) struct RenderLineBreak {}
pub(crate) struct RenderLineBreak {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderLineBreak, ILineBreak);

View File

@ -24,9 +24,11 @@ macro_rules! rnoop {
impl $rstruct {
pub(crate) fn new(
_render_context: RenderContext<'_>,
_original: &$istruct,
original: &$istruct,
) -> Result<$rstruct, CustomError> {
Ok($rstruct {})
Ok($rstruct {
post_blank: original.post_blank,
})
}
}
};

View File

@ -41,6 +41,7 @@ mod paragraph;
mod plain_link;
mod plain_list;
mod plain_list_item;
mod plain_list_simple_item;
mod plain_text;
mod planning;
mod property_drawer;

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "org_macro")]
pub(crate) struct RenderOrgMacro {}
pub(crate) struct RenderOrgMacro {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderOrgMacro, IOrgMacro);

View File

@ -12,6 +12,7 @@ use super::RenderObject;
#[serde(rename = "paragraph")]
pub(crate) struct RenderParagraph {
children: Vec<RenderObject>,
post_blank: organic::types::PostBlank,
}
render!(RenderParagraph, IParagraph, original, render_context, {
@ -23,5 +24,8 @@ render!(RenderParagraph, IParagraph, original, render_context, {
ret
};
Ok(RenderParagraph { children })
Ok(RenderParagraph {
children,
post_blank: original.post_blank,
})
});

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "plain_link")]
pub(crate) struct RenderPlainLink {}
pub(crate) struct RenderPlainLink {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderPlainLink, IPlainLink);

View File

@ -13,6 +13,7 @@ use super::plain_list_item::RenderPlainListItem;
pub(crate) struct RenderPlainList {
list_type: String,
children: Vec<RenderPlainListItem>,
post_blank: organic::types::PostBlank,
}
render!(RenderPlainList, IPlainList, original, render_context, {
@ -32,5 +33,6 @@ render!(RenderPlainList, IPlainList, original, render_context, {
Ok(RenderPlainList {
list_type,
children,
post_blank: original.post_blank,
})
});

View File

@ -0,0 +1,38 @@
use serde::Serialize;
use super::render_context::RenderContext;
use crate::error::CustomError;
use crate::intermediate::IPlainListSimpleItem;
use super::macros::render;
use super::RenderObject;
/// Special case for list items with only paragraphs and sublists as their children. In those cases, the paragraph tags are omitted. This is equivalent to a Paragraph but in a different struct to have a different type tag.
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "plain_list_simple_item")]
pub(crate) struct RenderPlainListSimpleItem {
children: Vec<RenderObject>,
post_blank: organic::types::PostBlank,
}
render!(
RenderPlainListSimpleItem,
IPlainListSimpleItem,
original,
render_context,
{
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(RenderObject::new(render_context.clone(), obj)?);
}
ret
};
Ok(RenderPlainListSimpleItem {
children,
post_blank: original.post_blank,
})
}
);

View File

@ -11,10 +11,12 @@ use super::macros::render;
#[serde(rename = "plain_text")]
pub(crate) struct RenderPlainText {
source: String,
post_blank: organic::types::PostBlank,
}
render!(RenderPlainText, IPlainText, original, _render_context, {
Ok(RenderPlainText {
source: original.source.clone(),
post_blank: original.post_blank,
})
});

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "planning")]
pub(crate) struct RenderPlanning {}
pub(crate) struct RenderPlanning {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderPlanning, IPlanning);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "property_drawer")]
pub(crate) struct RenderPropertyDrawer {}
pub(crate) struct RenderPropertyDrawer {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderPropertyDrawer, IPropertyDrawer);

View File

@ -12,6 +12,7 @@ use super::RenderElement;
#[serde(rename = "quote_block")]
pub(crate) struct RenderQuoteBlock {
children: Vec<RenderElement>,
post_blank: organic::types::PostBlank,
}
render!(RenderQuoteBlock, IQuoteBlock, original, render_context, {
@ -23,5 +24,8 @@ render!(RenderQuoteBlock, IQuoteBlock, original, render_context, {
ret
};
Ok(RenderQuoteBlock { children })
Ok(RenderQuoteBlock {
children,
post_blank: original.post_blank,
})
});

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "radio_link")]
pub(crate) struct RenderRadioLink {}
pub(crate) struct RenderRadioLink {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderRadioLink, IRadioLink);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "radio_target")]
pub(crate) struct RenderRadioTarget {}
pub(crate) struct RenderRadioTarget {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderRadioTarget, IRadioTarget);

View File

@ -13,6 +13,7 @@ use super::RenderObject;
pub(crate) struct RenderRegularLink {
raw_link: String,
children: Vec<RenderObject>,
post_blank: organic::types::PostBlank,
}
render!(RenderRegularLink, IRegularLink, original, render_context, {
@ -27,5 +28,6 @@ render!(RenderRegularLink, IRegularLink, original, render_context, {
Ok(RenderRegularLink {
raw_link: original.raw_link.clone(),
children,
post_blank: original.post_blank,
})
});

View File

@ -12,6 +12,7 @@ use super::RenderElement;
#[serde(rename = "section")]
pub(crate) struct RenderSection {
children: Vec<RenderElement>,
post_blank: organic::types::PostBlank,
}
render!(RenderSection, ISection, original, render_context, {
@ -23,5 +24,8 @@ render!(RenderSection, ISection, original, render_context, {
ret
};
Ok(RenderSection { children })
Ok(RenderSection {
children,
post_blank: original.post_blank,
})
});

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "special_block")]
pub(crate) struct RenderSpecialBlock {}
pub(crate) struct RenderSpecialBlock {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderSpecialBlock, ISpecialBlock);

View File

@ -11,10 +11,14 @@ use super::macros::render;
#[serde(rename = "src_block")]
pub(crate) struct RenderSrcBlock {
lines: Vec<String>,
language: Option<String>,
post_blank: organic::types::PostBlank,
}
render!(RenderSrcBlock, ISrcBlock, original, _render_context, {
Ok(RenderSrcBlock {
lines: original.lines.clone(),
language: original.language.clone(),
post_blank: original.post_blank,
})
});

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "statistics_cookie")]
pub(crate) struct RenderStatisticsCookie {}
pub(crate) struct RenderStatisticsCookie {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderStatisticsCookie, IStatisticsCookie);

View File

@ -12,6 +12,7 @@ use super::RenderObject;
#[serde(rename = "strike_through")]
pub(crate) struct RenderStrikeThrough {
children: Vec<RenderObject>,
post_blank: organic::types::PostBlank,
}
render!(
@ -28,6 +29,9 @@ render!(
ret
};
Ok(RenderStrikeThrough { children })
Ok(RenderStrikeThrough {
children,
post_blank: original.post_blank,
})
}
);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "subscript")]
pub(crate) struct RenderSubscript {}
pub(crate) struct RenderSubscript {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderSubscript, ISubscript);

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "superscript")]
pub(crate) struct RenderSuperscript {}
pub(crate) struct RenderSuperscript {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderSuperscript, ISuperscript);

View File

@ -12,6 +12,7 @@ use super::table_row::RenderTableRow;
#[serde(rename = "table")]
pub(crate) struct RenderTable {
children: Vec<RenderTableRow>,
post_blank: organic::types::PostBlank,
}
render!(RenderTable, ITable, original, render_context, {
@ -23,5 +24,8 @@ render!(RenderTable, ITable, original, render_context, {
ret
};
Ok(RenderTable { children })
Ok(RenderTable {
children,
post_blank: original.post_blank,
})
});

View File

@ -11,10 +11,12 @@ use super::macros::render;
#[serde(rename = "target")]
pub(crate) struct RenderTarget {
id: String,
post_blank: organic::types::PostBlank,
}
render!(RenderTarget, ITarget, original, _render_context, {
Ok(RenderTarget {
id: original.id.clone(),
post_blank: original.post_blank,
})
});

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "timestamp")]
pub(crate) struct RenderTimestamp {}
pub(crate) struct RenderTimestamp {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderTimestamp, ITimestamp);

View File

@ -12,6 +12,7 @@ use super::RenderObject;
#[serde(rename = "underline")]
pub(crate) struct RenderUnderline {
children: Vec<RenderObject>,
post_blank: organic::types::PostBlank,
}
render!(RenderUnderline, IUnderline, original, render_context, {
@ -23,5 +24,8 @@ render!(RenderUnderline, IUnderline, original, render_context, {
ret
};
Ok(RenderUnderline { children })
Ok(RenderUnderline {
children,
post_blank: original.post_blank,
})
});

View File

@ -11,10 +11,12 @@ use super::macros::render;
#[serde(rename = "verbatim")]
pub(crate) struct RenderVerbatim {
contents: String,
post_blank: organic::types::PostBlank,
}
render!(RenderVerbatim, IVerbatim, original, _render_context, {
Ok(RenderVerbatim {
contents: original.contents.clone(),
post_blank: original.post_blank,
})
});

View File

@ -9,6 +9,8 @@ use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "verse_block")]
pub(crate) struct RenderVerseBlock {}
pub(crate) struct RenderVerseBlock {
post_blank: organic::types::PostBlank,
}
rnoop!(RenderVerseBlock, IVerseBlock);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IAngleLink, AngleLink);

View File

@ -18,7 +18,6 @@ use super::plain_link::IPlainLink;
use super::plain_text::IPlainText;
use super::radio_link::IRadioLink;
use super::radio_target::IRadioTarget;
use super::regular_link::IRegularLink;
use super::statistics_cookie::IStatisticsCookie;
use super::strike_through::IStrikeThrough;
@ -52,7 +51,7 @@ use super::ITimestamp;
use super::IUnderline;
use super::IVerbatim;
use super::IVerseBlock;
use super::RefRegistry;
use super::IntermediateContext;
use crate::error::CustomError;
use futures::future::{BoxFuture, FutureExt};
@ -116,23 +115,23 @@ pub(crate) enum IAstNode {
pub(crate) trait IntoIAstNode<'parse> {
fn into_ast_node<'orig>(
&'orig self,
registry: RefRegistry<'orig, 'parse>,
intermediate_context: IntermediateContext<'orig, 'parse>,
) -> BoxFuture<'orig, Result<IAstNode, CustomError>>;
}
impl<'parse> IntoIAstNode<'parse> for organic::types::DocumentElement<'parse> {
fn into_ast_node<'orig>(
&'orig self,
registry: RefRegistry<'orig, 'parse>,
intermediate_context: IntermediateContext<'orig, 'parse>,
) -> BoxFuture<'orig, Result<IAstNode, CustomError>> {
async move {
match self {
organic::types::DocumentElement::Heading(inner) => {
Ok(IAstNode::Heading(IHeading::new(registry, inner).await?))
}
organic::types::DocumentElement::Section(inner) => {
Ok(IAstNode::Section(ISection::new(registry, inner).await?))
}
organic::types::DocumentElement::Heading(inner) => Ok(IAstNode::Heading(
IHeading::new(intermediate_context, inner).await?,
)),
organic::types::DocumentElement::Section(inner) => Ok(IAstNode::Section(
ISection::new(intermediate_context, inner).await?,
)),
}
}
.boxed()
@ -142,81 +141,83 @@ impl<'parse> IntoIAstNode<'parse> for organic::types::DocumentElement<'parse> {
impl<'parse> IntoIAstNode<'parse> for organic::types::Element<'parse> {
fn into_ast_node<'orig>(
&'orig self,
registry: RefRegistry<'orig, 'parse>,
intermediate_context: IntermediateContext<'orig, 'parse>,
) -> BoxFuture<'orig, Result<IAstNode, CustomError>> {
async move {
match self {
organic::types::Element::Paragraph(inner) => {
Ok(IAstNode::Paragraph(IParagraph::new(registry, inner).await?))
}
organic::types::Element::PlainList(inner) => {
Ok(IAstNode::PlainList(IPlainList::new(registry, inner).await?))
}
organic::types::Element::Paragraph(inner) => Ok(IAstNode::Paragraph(
IParagraph::new(intermediate_context, inner).await?,
)),
organic::types::Element::PlainList(inner) => Ok(IAstNode::PlainList(
IPlainList::new(intermediate_context, inner).await?,
)),
organic::types::Element::CenterBlock(inner) => Ok(IAstNode::CenterBlock(
ICenterBlock::new(registry, inner).await?,
ICenterBlock::new(intermediate_context, inner).await?,
)),
organic::types::Element::QuoteBlock(inner) => Ok(IAstNode::QuoteBlock(
IQuoteBlock::new(registry, inner).await?,
IQuoteBlock::new(intermediate_context, inner).await?,
)),
organic::types::Element::SpecialBlock(inner) => Ok(IAstNode::SpecialBlock(
ISpecialBlock::new(registry, inner).await?,
ISpecialBlock::new(intermediate_context, inner).await?,
)),
organic::types::Element::DynamicBlock(inner) => Ok(IAstNode::DynamicBlock(
IDynamicBlock::new(registry, inner).await?,
IDynamicBlock::new(intermediate_context, inner).await?,
)),
organic::types::Element::FootnoteDefinition(inner) => Ok(
IAstNode::FootnoteDefinition(IFootnoteDefinition::new(registry, inner).await?),
),
organic::types::Element::Comment(inner) => {
Ok(IAstNode::Comment(IComment::new(registry, inner).await?))
}
organic::types::Element::Drawer(inner) => {
Ok(IAstNode::Drawer(IDrawer::new(registry, inner).await?))
organic::types::Element::FootnoteDefinition(inner) => {
Ok(IAstNode::FootnoteDefinition(
IFootnoteDefinition::new(intermediate_context, inner).await?,
))
}
organic::types::Element::Comment(inner) => Ok(IAstNode::Comment(
IComment::new(intermediate_context, inner).await?,
)),
organic::types::Element::Drawer(inner) => Ok(IAstNode::Drawer(
IDrawer::new(intermediate_context, inner).await?,
)),
organic::types::Element::PropertyDrawer(inner) => Ok(IAstNode::PropertyDrawer(
IPropertyDrawer::new(registry, inner).await?,
IPropertyDrawer::new(intermediate_context, inner).await?,
)),
organic::types::Element::Table(inner) => Ok(IAstNode::Table(
ITable::new(intermediate_context, inner).await?,
)),
organic::types::Element::Table(inner) => {
Ok(IAstNode::Table(ITable::new(registry, inner).await?))
}
organic::types::Element::VerseBlock(inner) => Ok(IAstNode::VerseBlock(
IVerseBlock::new(registry, inner).await?,
IVerseBlock::new(intermediate_context, inner).await?,
)),
organic::types::Element::CommentBlock(inner) => Ok(IAstNode::CommentBlock(
ICommentBlock::new(registry, inner).await?,
ICommentBlock::new(intermediate_context, inner).await?,
)),
organic::types::Element::ExampleBlock(inner) => Ok(IAstNode::ExampleBlock(
IExampleBlock::new(registry, inner).await?,
IExampleBlock::new(intermediate_context, inner).await?,
)),
organic::types::Element::ExportBlock(inner) => Ok(IAstNode::ExportBlock(
IExportBlock::new(registry, inner).await?,
IExportBlock::new(intermediate_context, inner).await?,
)),
organic::types::Element::SrcBlock(inner) => Ok(IAstNode::SrcBlock(
ISrcBlock::new(intermediate_context, inner).await?,
)),
organic::types::Element::Clock(inner) => Ok(IAstNode::Clock(
IClock::new(intermediate_context, inner).await?,
)),
organic::types::Element::DiarySexp(inner) => Ok(IAstNode::DiarySexp(
IDiarySexp::new(intermediate_context, inner).await?,
)),
organic::types::Element::Planning(inner) => Ok(IAstNode::Planning(
IPlanning::new(intermediate_context, inner).await?,
)),
organic::types::Element::SrcBlock(inner) => {
Ok(IAstNode::SrcBlock(ISrcBlock::new(registry, inner).await?))
}
organic::types::Element::Clock(inner) => {
Ok(IAstNode::Clock(IClock::new(registry, inner).await?))
}
organic::types::Element::DiarySexp(inner) => {
Ok(IAstNode::DiarySexp(IDiarySexp::new(registry, inner).await?))
}
organic::types::Element::Planning(inner) => {
Ok(IAstNode::Planning(IPlanning::new(registry, inner).await?))
}
organic::types::Element::FixedWidthArea(inner) => Ok(IAstNode::FixedWidthArea(
IFixedWidthArea::new(registry, inner).await?,
IFixedWidthArea::new(intermediate_context, inner).await?,
)),
organic::types::Element::HorizontalRule(inner) => Ok(IAstNode::HorizontalRule(
IHorizontalRule::new(registry, inner).await?,
IHorizontalRule::new(intermediate_context, inner).await?,
)),
organic::types::Element::Keyword(inner) => Ok(IAstNode::Keyword(
IKeyword::new(intermediate_context, inner).await?,
)),
organic::types::Element::BabelCall(inner) => Ok(IAstNode::BabelCall(
IBabelCall::new(intermediate_context, inner).await?,
)),
organic::types::Element::Keyword(inner) => {
Ok(IAstNode::Keyword(IKeyword::new(registry, inner).await?))
}
organic::types::Element::BabelCall(inner) => {
Ok(IAstNode::BabelCall(IBabelCall::new(registry, inner).await?))
}
organic::types::Element::LatexEnvironment(inner) => Ok(IAstNode::LatexEnvironment(
ILatexEnvironment::new(registry, inner).await?,
ILatexEnvironment::new(intermediate_context, inner).await?,
)),
}
}
@ -227,91 +228,97 @@ impl<'parse> IntoIAstNode<'parse> for organic::types::Element<'parse> {
impl<'parse> IntoIAstNode<'parse> for organic::types::Object<'parse> {
fn into_ast_node<'orig>(
&'orig self,
registry: RefRegistry<'orig, 'parse>,
intermediate_context: IntermediateContext<'orig, 'parse>,
) -> BoxFuture<'orig, Result<IAstNode, CustomError>> {
async move {
match self {
organic::types::Object::Bold(inner) => {
Ok(IAstNode::Bold(IBold::new(registry, inner).await?))
}
organic::types::Object::Italic(inner) => {
Ok(IAstNode::Italic(IItalic::new(registry, inner).await?))
}
organic::types::Object::Underline(inner) => {
Ok(IAstNode::Underline(IUnderline::new(registry, inner).await?))
}
organic::types::Object::Bold(inner) => Ok(IAstNode::Bold(
IBold::new(intermediate_context, inner).await?,
)),
organic::types::Object::Italic(inner) => Ok(IAstNode::Italic(
IItalic::new(intermediate_context, inner).await?,
)),
organic::types::Object::Underline(inner) => Ok(IAstNode::Underline(
IUnderline::new(intermediate_context, inner).await?,
)),
organic::types::Object::StrikeThrough(inner) => Ok(IAstNode::StrikeThrough(
IStrikeThrough::new(registry, inner).await?,
IStrikeThrough::new(intermediate_context, inner).await?,
)),
organic::types::Object::Code(inner) => Ok(IAstNode::Code(
ICode::new(intermediate_context, inner).await?,
)),
organic::types::Object::Verbatim(inner) => Ok(IAstNode::Verbatim(
IVerbatim::new(intermediate_context, inner).await?,
)),
organic::types::Object::PlainText(inner) => Ok(IAstNode::PlainText(
IPlainText::new(intermediate_context, inner).await?,
)),
organic::types::Object::Code(inner) => {
Ok(IAstNode::Code(ICode::new(registry, inner).await?))
}
organic::types::Object::Verbatim(inner) => {
Ok(IAstNode::Verbatim(IVerbatim::new(registry, inner).await?))
}
organic::types::Object::PlainText(inner) => {
Ok(IAstNode::PlainText(IPlainText::new(registry, inner).await?))
}
organic::types::Object::RegularLink(inner) => Ok(IAstNode::RegularLink(
IRegularLink::new(registry, inner).await?,
IRegularLink::new(intermediate_context, inner).await?,
)),
organic::types::Object::RadioLink(inner) => Ok(IAstNode::RadioLink(
IRadioLink::new(intermediate_context, inner).await?,
)),
organic::types::Object::RadioLink(inner) => {
Ok(IAstNode::RadioLink(IRadioLink::new(registry, inner).await?))
}
organic::types::Object::RadioTarget(inner) => Ok(IAstNode::RadioTarget(
IRadioTarget::new(registry, inner).await?,
IRadioTarget::new(intermediate_context, inner).await?,
)),
organic::types::Object::PlainLink(inner) => Ok(IAstNode::PlainLink(
IPlainLink::new(intermediate_context, inner).await?,
)),
organic::types::Object::AngleLink(inner) => Ok(IAstNode::AngleLink(
IAngleLink::new(intermediate_context, inner).await?,
)),
organic::types::Object::OrgMacro(inner) => Ok(IAstNode::OrgMacro(
IOrgMacro::new(intermediate_context, inner).await?,
)),
organic::types::Object::Entity(inner) => Ok(IAstNode::Entity(
IEntity::new(intermediate_context, inner).await?,
)),
organic::types::Object::PlainLink(inner) => {
Ok(IAstNode::PlainLink(IPlainLink::new(registry, inner).await?))
}
organic::types::Object::AngleLink(inner) => {
Ok(IAstNode::AngleLink(IAngleLink::new(registry, inner).await?))
}
organic::types::Object::OrgMacro(inner) => {
Ok(IAstNode::OrgMacro(IOrgMacro::new(registry, inner).await?))
}
organic::types::Object::Entity(inner) => {
Ok(IAstNode::Entity(IEntity::new(registry, inner).await?))
}
organic::types::Object::LatexFragment(inner) => Ok(IAstNode::LatexFragment(
ILatexFragment::new(registry, inner).await?,
ILatexFragment::new(intermediate_context, inner).await?,
)),
organic::types::Object::ExportSnippet(inner) => Ok(IAstNode::ExportSnippet(
IExportSnippet::new(registry, inner).await?,
IExportSnippet::new(intermediate_context, inner).await?,
)),
organic::types::Object::FootnoteReference(inner) => Ok(
IAstNode::FootnoteReference(IFootnoteReference::new(registry, inner).await?),
),
organic::types::Object::Citation(inner) => {
Ok(IAstNode::Citation(ICitation::new(registry, inner).await?))
organic::types::Object::FootnoteReference(inner) => {
Ok(IAstNode::FootnoteReference(
IFootnoteReference::new(intermediate_context, inner).await?,
))
}
organic::types::Object::Citation(inner) => Ok(IAstNode::Citation(
ICitation::new(intermediate_context, inner).await?,
)),
organic::types::Object::CitationReference(inner) => {
Ok(IAstNode::CitationReference(
ICitationReference::new(intermediate_context, inner).await?,
))
}
organic::types::Object::CitationReference(inner) => Ok(
IAstNode::CitationReference(ICitationReference::new(registry, inner).await?),
),
organic::types::Object::InlineBabelCall(inner) => Ok(IAstNode::InlineBabelCall(
IInlineBabelCall::new(registry, inner).await?,
IInlineBabelCall::new(intermediate_context, inner).await?,
)),
organic::types::Object::InlineSourceBlock(inner) => Ok(
IAstNode::InlineSourceBlock(IInlineSourceBlock::new(registry, inner).await?),
),
organic::types::Object::LineBreak(inner) => {
Ok(IAstNode::LineBreak(ILineBreak::new(registry, inner).await?))
}
organic::types::Object::Target(inner) => {
Ok(IAstNode::Target(ITarget::new(registry, inner).await?))
organic::types::Object::InlineSourceBlock(inner) => {
Ok(IAstNode::InlineSourceBlock(
IInlineSourceBlock::new(intermediate_context, inner).await?,
))
}
organic::types::Object::LineBreak(inner) => Ok(IAstNode::LineBreak(
ILineBreak::new(intermediate_context, inner).await?,
)),
organic::types::Object::Target(inner) => Ok(IAstNode::Target(
ITarget::new(intermediate_context, inner).await?,
)),
organic::types::Object::StatisticsCookie(inner) => Ok(IAstNode::StatisticsCookie(
IStatisticsCookie::new(registry, inner).await?,
IStatisticsCookie::new(intermediate_context, inner).await?,
)),
organic::types::Object::Subscript(inner) => Ok(IAstNode::Subscript(
ISubscript::new(intermediate_context, inner).await?,
)),
organic::types::Object::Subscript(inner) => {
Ok(IAstNode::Subscript(ISubscript::new(registry, inner).await?))
}
organic::types::Object::Superscript(inner) => Ok(IAstNode::Superscript(
ISuperscript::new(registry, inner).await?,
ISuperscript::new(intermediate_context, inner).await?,
)),
organic::types::Object::Timestamp(inner) => Ok(IAstNode::Timestamp(
ITimestamp::new(intermediate_context, inner).await?,
)),
organic::types::Object::Timestamp(inner) => {
Ok(IAstNode::Timestamp(ITimestamp::new(registry, inner).await?))
}
}
}
.boxed()

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IBabelCall, BabelCall);

View File

@ -9,6 +9,7 @@ use walkdir::WalkDir;
use crate::error::CustomError;
use crate::intermediate::page::BlogPostPageInput;
use crate::intermediate::registry::Registry;
use crate::intermediate::IntermediateContext;
use super::BlogPostPage;
@ -62,10 +63,11 @@ impl BlogPost {
});
let registry = Arc::new(Mutex::new(registry));
let intermediate_context = IntermediateContext::new(registry)?;
let relative_to_post_dir_path = real_path.strip_prefix(post_dir)?;
ret.push(
BlogPostPage::new(
registry,
intermediate_context,
BlogPostPageInput::new(relative_to_post_dir_path, parsed_document),
)
.await?,

View File

@ -1,3 +1,5 @@
use organic::types::StandardProperties;
use super::macros::intermediate;
use super::IObject;
@ -6,22 +8,26 @@ use crate::error::CustomError;
#[derive(Debug, Clone)]
pub(crate) struct IBold {
pub(crate) children: Vec<IObject>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
IBold,
&'orig organic::types::Bold<'parse>,
original,
registry,
intermediate_context,
{
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(IObject::new(registry.clone(), obj).await?);
ret.push(IObject::new(intermediate_context.clone(), obj).await?);
}
ret
};
Ok(IBold { children })
Ok(IBold {
children,
post_blank: original.get_post_blank(),
})
}
);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ICenterBlock, CenterBlock);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ICitation, Citation);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ICitationReference, CitationReference);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IClock, Clock);

View File

@ -1,3 +1,5 @@
use organic::types::StandardProperties;
use super::macros::intermediate;
use crate::error::CustomError;
@ -5,17 +7,19 @@ use crate::error::CustomError;
#[derive(Debug, Clone)]
pub(crate) struct ICode {
pub(crate) contents: String,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
ICode,
&'orig organic::types::Code<'parse>,
original,
_registry,
_intermediate_context,
{
Ok(ICode {
// TODO: Should this coalesce whitespace like PlainText?
contents: original.contents.to_owned(),
post_blank: original.get_post_blank(),
})
}
);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IComment, Comment);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ICommentBlock, CommentBlock);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IDiarySexp, DiarySexp);

View File

@ -12,19 +12,25 @@ pub(crate) enum IDocumentElement {
Section(ISection),
}
iselector!(IDocumentElement, DocumentElement, original, registry, {
iitem!(
registry,
original,
(
organic::types::DocumentElement::Heading,
IDocumentElement::Heading,
IHeading
),
(
organic::types::DocumentElement::Section,
IDocumentElement::Section,
ISection
),
)
});
iselector!(
IDocumentElement,
DocumentElement,
original,
intermediate_context,
{
iitem!(
intermediate_context,
original,
(
organic::types::DocumentElement::Heading,
IDocumentElement::Heading,
IHeading
),
(
organic::types::DocumentElement::Section,
IDocumentElement::Section,
ISection
),
)
}
);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IDrawer, Drawer);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IDynamicBlock, DynamicBlock);

View File

@ -1,6 +1,7 @@
use super::comment::IComment;
use super::keyword::IKeyword;
use super::macros::iselector;
use super::IPlainListSimpleItem;
use super::IBabelCall;
use super::ICenterBlock;
@ -32,6 +33,7 @@ use futures::future::{BoxFuture, FutureExt};
pub(crate) enum IElement {
Paragraph(IParagraph),
PlainList(IPlainList),
PlainListSimpleItem(IPlainListSimpleItem),
CenterBlock(ICenterBlock),
QuoteBlock(IQuoteBlock),
SpecialBlock(ISpecialBlock),
@ -56,9 +58,9 @@ pub(crate) enum IElement {
LatexEnvironment(ILatexEnvironment),
}
iselector!(IElement, Element, original, registry, {
iselector!(IElement, Element, original, intermediate_context, {
iitem!(
registry,
intermediate_context,
original,
(
organic::types::Element::Paragraph,

View File

@ -1,20 +1,22 @@
use super::macros::intermediate;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct IEntity {
pub(crate) html: String,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
IEntity,
&'orig organic::types::Entity<'parse>,
original,
_registry,
_intermediate_context,
{
Ok(IEntity {
html: original.html.to_owned(),
post_blank: original.get_post_blank(),
})
}
);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IExampleBlock, ExampleBlock);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IExportBlock, ExportBlock);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IExportSnippet, ExportSnippet);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IFixedWidthArea, FixedWidthArea);

View File

@ -1,33 +1,39 @@
use super::macros::intermediate;
use super::registry::register_footnote_definition;
use super::IAstNode;
use super::IntermediateContext;
use crate::error::CustomError;
use crate::intermediate::RefRegistry;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct IFootnoteDefinition {}
pub(crate) struct IFootnoteDefinition {
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
IFootnoteDefinition,
&'orig organic::types::FootnoteDefinition<'parse>,
original,
registry,
intermediate_context,
{
register_footnote_definition(registry, original.label, &original.children).await?;
Ok(IFootnoteDefinition {})
register_footnote_definition(intermediate_context, original.label, &original.children)
.await?;
Ok(IFootnoteDefinition {
post_blank: original.get_post_blank(),
})
}
);
#[derive(Debug)]
pub(crate) struct IRealFootnoteDefinition {
// TODO: Do I need post_blank for the real footnote definitions?
pub(crate) footnote_id: usize,
pub(crate) contents: Vec<IAstNode>,
}
impl IRealFootnoteDefinition {
pub(crate) async fn new<'orig, 'parse>(
_registry: RefRegistry<'orig, 'parse>,
_intermediate_context: IntermediateContext<'orig, 'parse>,
footnote_id: usize,
contents: Vec<IAstNode>,
) -> Result<IRealFootnoteDefinition, CustomError> {

View File

@ -1,25 +1,28 @@
use super::macros::intermediate;
use super::registry::get_footnote_reference_id;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct IFootnoteReference {
footnote_id: usize,
duplicate_offset: usize,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
IFootnoteReference,
&'orig organic::types::FootnoteReference<'parse>,
original,
registry,
intermediate_context,
{
let (footnote_id, reference_count) =
get_footnote_reference_id(registry, original.label, &original.definition).await?;
get_footnote_reference_id(intermediate_context, original.label, &original.definition)
.await?;
Ok(IFootnoteReference {
footnote_id,
duplicate_offset: reference_count,
post_blank: original.get_post_blank(),
})
}
);

View File

@ -1,33 +1,34 @@
use super::macros::intermediate;
use super::IDocumentElement;
use super::IObject;
use crate::error::CustomError;
use organic::types::StandardProperties;
#[derive(Debug, Clone)]
pub(crate) struct IHeading {
pub(crate) level: organic::types::HeadlineLevel,
pub(crate) title: Vec<IObject>,
pub(crate) children: Vec<IDocumentElement>,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
IHeading,
&'orig organic::types::Heading<'parse>,
original,
registry,
intermediate_context,
{
let title = {
let mut ret = Vec::new();
for obj in original.title.iter() {
ret.push(IObject::new(registry.clone(), obj).await?);
ret.push(IObject::new(intermediate_context.clone(), obj).await?);
}
ret
};
let children = {
let mut ret = Vec::new();
for obj in original.children.iter() {
ret.push(IDocumentElement::new(registry.clone(), obj).await?);
ret.push(IDocumentElement::new(intermediate_context.clone(), obj).await?);
}
ret
};
@ -35,6 +36,7 @@ intermediate!(
title,
level: original.level,
children,
post_blank: original.get_post_blank(),
})
}
);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IHorizontalRule, HorizontalRule);

View File

@ -1,5 +1,5 @@
use super::macros::inoop;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(IInlineBabelCall, InlineBabelCall);

Some files were not shown because too many files have changed in this diff Show More