From d47c536f973f48d35081c4dbbfbd2b13394d9aa7 Mon Sep 17 00:00:00 2001 From: Vika Date: Wed, 27 Jul 2022 11:14:04 +0300 Subject: kittybox-templates: split out MF2 rendering and get rid of log crate Kittybox now uses tracing instead of log. Why would I keep an unneccesary dependency in my Cargo.lock? --- kittybox-rs/templates/src/lib.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'kittybox-rs/templates/src/lib.rs') diff --git a/kittybox-rs/templates/src/lib.rs b/kittybox-rs/templates/src/lib.rs index 8e9abba..d58e831 100644 --- a/kittybox-rs/templates/src/lib.rs +++ b/kittybox-rs/templates/src/lib.rs @@ -1,9 +1,13 @@ mod templates; -pub use templates::{Entry, ErrorPage, Feed, MainPage, Template, VCard, POSTS_PER_PAGE}; +pub use templates::{ErrorPage, MainPage, Template}; mod onboarding; pub use onboarding::OnboardingPage; +mod indieauth; +pub use indieauth::AuthorizationRequestPage; mod login; pub use login::LoginPage; +mod mf2; +pub use mf2::{Entry, VCard, Feed, Food, POSTS_PER_PAGE}; #[cfg(test)] mod tests { @@ -196,11 +200,9 @@ mod tests { #[test] #[ignore = "see https://gitlab.com/maxburon/microformats-parser/-/issues/7"] fn test_note() { - test_logger::ensure_env_logger_initialized(); - let mf2 = gen_random_post(&rand::random::().to_string(), PostType::Note); - let html = crate::templates::Entry { post: &mf2 }.to_string(); + let html = crate::mf2::Entry { post: &mf2 }.to_string(); let url: Url = mf2 .pointer("/properties/uid/0") @@ -231,10 +233,8 @@ mod tests { #[test] fn test_article() { - test_logger::ensure_env_logger_initialized(); - let mf2 = gen_random_post(&rand::random::().to_string(), PostType::Article); - let html = crate::templates::Entry { post: &mf2 }.to_string(); + let html = crate::mf2::Entry { post: &mf2 }.to_string(); let url: Url = mf2 .pointer("/properties/uid/0") .and_then(|i| i.as_str()) @@ -273,8 +273,6 @@ mod tests { #[test] fn test_like_of() { - test_logger::ensure_env_logger_initialized(); - for likeof in [ PostType::LikeOf(gen_random_post( &rand::random::().to_string(), @@ -294,7 +292,7 @@ mod tests { .and_then(|i| i.as_str()) .and_then(|u| u.parse().ok()) .unwrap(); - let html = crate::templates::Entry { post: &mf2 }.to_string(); + let html = crate::mf2::Entry { post: &mf2 }.to_string(); let parsed: Document = microformats::from_html(&html, url.clone()).unwrap(); if let Some(item) = parsed.items.get(0) { -- cgit 1.4.1