diff options
Diffstat (limited to 'src/directive/tag.rs')
-rw-r--r-- | src/directive/tag.rs | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/directive/tag.rs b/src/directive/tag.rs index c64acfc..6d4377d 100644 --- a/src/directive/tag.rs +++ b/src/directive/tag.rs @@ -1,3 +1,4 @@ +use crate::directive::{DirectiveImplementation, Processed}; use crate::error::SiteError; use crate::page::PageMeta; use crate::site::Site; @@ -8,23 +9,23 @@ pub struct Tag { tags: Vec<String>, } -impl Tag { - pub const REQUIRED: &'static [&'static str] = &[]; - pub const ALLOWED: &'static [&'static str] = &["class"]; - pub const ALLOW_ANY_UNNAMED: bool = true; +impl DirectiveImplementation for Tag { + const REQUIRED: &'static [&'static str] = &[]; + const ALLOWED: &'static [&'static str] = &["class"]; + const ALLOW_ANY_UNNAMED: bool = true; - pub fn new(tags: Vec<String>) -> Self { - Self { tags } + fn from_parsed(p: &ParsedDirective) -> Self { + let tags = p.unnamed_args().iter().map(|s| s.to_string()).collect(); + Tag::new(tags) } - pub fn process(&self, _site: &Site, _meta: &mut PageMeta) -> Result<String, SiteError> { - Ok("".into()) + fn process(&self, _site: &Site, _meta: &mut PageMeta) -> Result<Processed, SiteError> { + Ok(Processed::Markdown("".into())) } } -impl From<&ParsedDirective> for Tag { - fn from(p: &ParsedDirective) -> Self { - let tags = p.unnamed_args().iter().map(|s| s.to_string()).collect(); - Tag::new(tags) +impl Tag { + pub fn new(tags: Vec<String>) -> Self { + Self { tags } } } |