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.rs58
1 files changed, 57 insertions, 1 deletions
diff --git a/src/directive/mod.rs b/src/directive/mod.rs
index 38fb0d3..ee96bfc 100644
--- a/src/directive/mod.rs
+++ b/src/directive/mod.rs
@@ -12,9 +12,14 @@ pub enum Directive {
QuotedArg,
MultilineArg,
- Meta(Meta),
+ BrokenLinks(BrokenLinks),
Img(Img),
+ Inline(Inline),
+ Meta(Meta),
+ PageStats(PageStats),
+ Shortcut(Shortcut),
Tag(Tag),
+ Toc(Toc),
}
impl TryFrom<ParsedDirective> for Directive {
@@ -42,18 +47,49 @@ impl TryFrom<ParsedDirective> for Directive {
Self::check_args(&p, &["yo"], &["then", "else"], false)?;
Directive::MultilineArg
}
+
+ "brokenlinks" => {
+ Self::check_args(&p, BrokenLinks::REQUIRED, BrokenLinks::ALLOWED, BrokenLinks::ALLOW_ANY_UNNAMED)?;
+ Directive::BrokenLinks(BrokenLinks::from(p))
+ }
"img" => {
Self::check_args(&p, Img::REQUIRED, Img::ALLOWED, Img::ALLOW_ANY_UNNAMED)?;
Directive::Img(Img::from(p))
}
+ "inline" => {
+ Self::check_args(
+ &p,
+ Inline::REQUIRED,
+ Inline::ALLOWED,
+ Inline::ALLOW_ANY_UNNAMED,
+ )?;
+ Directive::Inline(Inline::from(p))
+ }
"meta" => {
Self::check_args(&p, Meta::REQUIRED, Meta::ALLOWED, Meta::ALLOW_ANY_UNNAMED)?;
Directive::Meta(Meta::from(p))
}
+ "pagestats" => {
+ Self::check_args(
+ &p,
+ PageStats::REQUIRED,
+ PageStats::ALLOWED,
+ PageStats::ALLOW_ANY_UNNAMED,
+ )?;
+ Directive::PageStats(PageStats::from(p))
+ }
+ "shortcut" => {
+ Self::check_args(&p, Shortcut::REQUIRED, Shortcut::ALLOWED, Shortcut::ALLOW_ANY_UNNAMED)?;
+ Directive::Shortcut(Shortcut::from(p))
+ }
"tag" => {
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)
@@ -100,18 +136,38 @@ impl Directive {
| Self::MultilineArg => {
panic!("directive {:?} may only be used in parsing tests", self)
}
+ Self::BrokenLinks(x) => x.process(site, meta),
Self::Img(x) => x.process(site, meta),
+ Self::Inline(x) => x.process(site, meta),
Self::Meta(x) => x.process(site, meta),
+ Self::PageStats(x) => x.process(site, meta),
+ Self::Shortcut(x) => x.process(site, meta),
Self::Tag(x) => x.process(site, meta),
+ Self::Toc(x) => x.process(site, meta),
}
}
}
+mod brokenlinks;
+use brokenlinks::BrokenLinks;
+
mod meta;
use meta::Meta;
mod img;
pub use img::Img;
+mod inline;
+pub use inline::Inline;
+
+mod pagestats;
+pub use pagestats::PageStats;
+
+mod shortcut;
+pub use shortcut::Shortcut;
+
mod tag;
use tag::Tag;
+
+mod toc;
+use toc::Toc;