summaryrefslogtreecommitdiff
path: root/src/directive/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/directive/mod.rs')
-rw-r--r--src/directive/mod.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/directive/mod.rs b/src/directive/mod.rs
index 59c352c..0767c9d 100644
--- a/src/directive/mod.rs
+++ b/src/directive/mod.rs
@@ -17,6 +17,7 @@ pub enum Directive {
Inline(Inline),
PageStats(PageStats),
Tag(Tag),
+ Toc(Toc),
}
impl TryFrom<ParsedDirective> for Directive {
@@ -64,6 +65,10 @@ impl TryFrom<ParsedDirective> for Directive {
Self::check_args(&p, Tag::REQUIRED, Tag::ALLOWED, Tag::ALLOW_ANY_UNNAMED)?;
Directive::Tag(Tag::from(p))
}
+ "toc" => {
+ Self::check_args(&p, Toc::REQUIRED, Toc::ALLOWED, Toc::ALLOW_ANY_UNNAMED)?;
+ Directive::Toc(Toc::from(p))
+ }
_ => return Err(SiteError::UnknownDirective(p.name().into())),
};
Ok(d)
@@ -115,6 +120,7 @@ impl Directive {
Self::Meta(x) => x.process(site, meta),
Self::PageStats(x) => x.process(site, meta),
Self::Tag(x) => x.process(site, meta),
+ Self::Toc(x) => x.process(site, meta),
}
}
}
@@ -133,3 +139,6 @@ pub use pagestats::PageStats;
mod tag;
use tag::Tag;
+
+mod toc;
+use toc::Toc;