diff options
Diffstat (limited to 'src/directive/tag.rs')
-rw-r--r-- | src/directive/tag.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/directive/tag.rs b/src/directive/tag.rs new file mode 100644 index 0000000..9486a7b --- /dev/null +++ b/src/directive/tag.rs @@ -0,0 +1,32 @@ +use crate::error::SiteError; +use crate::page::PageMeta; +use crate::site::Site; +use crate::wikitext::ParsedDirective; + +#[derive(Debug, Eq, PartialEq)] +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; + + pub fn new(tags: Vec<String>) -> Self { + Self { + tags, + } + } + + pub fn process(&self, _site: &Site, _meta: &mut PageMeta) -> Result<String, SiteError> { + Ok("".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) + } +} |