Use the raw timestamp source for rendering timestamps.
Some checks failed
format Build format has succeeded
clippy Build clippy has failed
rust-test Build rust-test has succeeded
build Build build has succeeded

This commit is contained in:
Tom Alexander 2025-02-22 12:23:35 -05:00
parent 073ac0ac25
commit c371b999d5
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 29 additions and 5 deletions

View File

@ -1 +1 @@
!!!!!!!! timestamp
<span class="timestamp">{.source}</span>

View File

@ -1,16 +1,21 @@
use serde::Serialize;
use super::macros::render;
use super::render_context::RenderContext;
use crate::error::CustomError;
use crate::intermediate::ITimestamp;
use super::macros::rnoop;
#[derive(Debug, Serialize)]
#[serde(tag = "type")]
#[serde(rename = "timestamp")]
pub(crate) struct RenderTimestamp {
source: String,
post_blank: organic::types::PostBlank,
}
rnoop!(RenderTimestamp, ITimestamp);
render!(RenderTimestamp, ITimestamp, original, _render_context, {
Ok(RenderTimestamp {
source: original.source.clone(),
post_blank: original.post_blank,
})
});

View File

@ -1,5 +1,24 @@
use super::macros::inoop;
use super::macros::intermediate;
use super::util::coalesce_whitespace;
use crate::error::CustomError;
use organic::types::StandardProperties;
inoop!(ITimestamp, Timestamp);
#[derive(Debug, Clone)]
pub(crate) struct ITimestamp {
pub(crate) source: String,
pub(crate) post_blank: organic::types::PostBlank,
}
intermediate!(
ITimestamp,
&'orig organic::types::Timestamp<'parse>,
original,
_intermediate_context,
{
Ok(ITimestamp {
source: coalesce_whitespace(original.source).into_owned(),
post_blank: original.get_post_blank(),
})
}
);