summaryrefslogtreecommitdiff
path: root/src/directive/toc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/directive/toc.rs')
-rw-r--r--src/directive/toc.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/directive/toc.rs b/src/directive/toc.rs
index af1bba9..ff03b0b 100644
--- a/src/directive/toc.rs
+++ b/src/directive/toc.rs
@@ -1,3 +1,4 @@
+use crate::directive::DirectiveImplementation;
use crate::error::SiteError;
use crate::page::PageMeta;
use crate::site::Site;
@@ -6,22 +7,16 @@ use crate::wikitext::ParsedDirective;
#[derive(Debug, Default, Eq, PartialEq)]
pub struct Toc {}
-impl Toc {
- pub const REQUIRED: &'static [&'static str] = &[];
- pub const ALLOWED: &'static [&'static str] = &["levels"];
- pub const ALLOW_ANY_UNNAMED: bool = true;
+impl DirectiveImplementation for Toc {
+ const REQUIRED: &'static [&'static str] = &[];
+ const ALLOWED: &'static [&'static str] = &["levels"];
+ const ALLOW_ANY_UNNAMED: bool = true;
- pub fn new() -> Self {
+ fn from_parsed(_: &ParsedDirective) -> Self {
Self::default()
}
- pub fn process(&self, _site: &Site, _meta: &mut PageMeta) -> Result<String, SiteError> {
+ fn process(&self, _site: &Site, _meta: &mut PageMeta) -> Result<String, SiteError> {
Err(SiteError::UnimplementedDirective("toc".into()))
}
}
-
-impl From<&ParsedDirective> for Toc {
- fn from(_p: &ParsedDirective) -> Self {
- Self::new()
- }
-}