From 102a4884c3d7d26817fefb38c675be07047f5ee2 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Sat, 15 Apr 2023 16:39:12 +0200 Subject: Add basic strategies --- src/file_handler/file_strategies/layout.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/file_handler/file_strategies/layout.rs') diff --git a/src/file_handler/file_strategies/layout.rs b/src/file_handler/file_strategies/layout.rs index e69de29..cf1bb9f 100644 --- a/src/file_handler/file_strategies/layout.rs +++ b/src/file_handler/file_strategies/layout.rs @@ -0,0 +1,24 @@ +pub struct Strategy {} + +use std::path::PathBuf; + +use crate::file_handler::{FileType, FileHandlerStrategy}; + +impl FileHandlerStrategy for Strategy { + fn is(&self, path: &PathBuf) -> bool { + return !path.is_dir() && path.ends_with("_layout.html"); + } + + fn identify(&self) -> FileType { + FileType::Layout + } + + fn can_handle(&self, path: &PathBuf) -> bool { + self.is(path) + } + + fn handle(&self, path: &PathBuf) { + println!("Should convert {}", path.display()) + } +} + -- cgit