about summary refs log tree commit diff
path: root/kittybox-rs/templates/src/lib.rs
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2022-07-27 11:14:04 +0300
committerVika <vika@fireburn.ru>2022-07-27 11:14:04 +0300
commitd47c536f973f48d35081c4dbbfbd2b13394d9aa7 (patch)
treec5bcef3ffe70eff52faff026f73338b97cb93695 /kittybox-rs/templates/src/lib.rs
parente88b656a7bd4e87d431249b37db75dec5ecc4e85 (diff)
downloadkittybox-d47c536f973f48d35081c4dbbfbd2b13394d9aa7.tar.zst
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?
Diffstat (limited to 'kittybox-rs/templates/src/lib.rs')
-rw-r--r--kittybox-rs/templates/src/lib.rs18
1 files changed, 8 insertions, 10 deletions
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::<Domain>().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::<Domain>().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::<Domain>().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) {