diff options
author | Vika <vika@fireburn.ru> | 2023-08-08 14:57:28 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2023-08-08 14:57:28 +0300 |
commit | 27b5bcc274675eab956e70bc59ba3e137e5aa676 (patch) | |
tree | c931a316ea47c9a148c684baace8c4c34271e5a8 /templates-neo/src/main.rs | |
parent | fbea42e5494c96174097bf3809a5b53d11d68a48 (diff) | |
download | kittybox-27b5bcc274675eab956e70bc59ba3e137e5aa676.tar.zst |
templates-neo: add a test CLI that renders entries
This allows interactively testing the markup.
Diffstat (limited to 'templates-neo/src/main.rs')
-rw-r--r-- | templates-neo/src/main.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/templates-neo/src/main.rs b/templates-neo/src/main.rs new file mode 100644 index 0000000..54afbb8 --- /dev/null +++ b/templates-neo/src/main.rs @@ -0,0 +1,16 @@ +use std::io::Write; + +use kittybox_html::mf2::Entry; + + +fn main() { + let mf2 = serde_json::from_reader::<_, microformats::types::Item>(std::io::stdin()).unwrap(); + let entry = Entry::try_from(mf2).unwrap(); + + let mut article = html::content::Article::builder(); + entry.build(&mut article); + + let mut stdout = std::io::stdout().lock(); + stdout.write_all(article.build().to_string().as_bytes()).unwrap(); + stdout.write_all(b"\n").unwrap(); +} \ No newline at end of file |