orgize/export/
mod.rs

1//! Export `Org` struct to various formats.
2
3mod html;
4mod org;
5
6#[cfg(feature = "syntect")]
7pub use html::SyntectHtmlHandler;
8pub use html::{DefaultHtmlHandler, HtmlEscape, HtmlHandler};
9pub use org::{DefaultOrgHandler, OrgHandler};
10
11use std::io::{Error, Write};
12
13use crate::elements::Datetime;
14
15pub(crate) fn write_datetime<W: Write>(
16    mut w: W,
17    start: &str,
18    datetime: &Datetime,
19    end: &str,
20) -> Result<(), Error> {
21    write!(w, "{}", start)?;
22    write!(
23        w,
24        "{}-{:02}-{:02} {}",
25        datetime.year, datetime.month, datetime.day, datetime.dayname
26    )?;
27    if let (Some(hour), Some(minute)) = (datetime.hour, datetime.minute) {
28        write!(w, " {:02}:{:02}", hour, minute)?;
29    }
30    write!(w, "{}", end)
31}