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.rs26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/directive/mod.rs b/src/directive/mod.rs
index 0767c9d..16d55c1 100644
--- a/src/directive/mod.rs
+++ b/src/directive/mod.rs
@@ -12,9 +12,10 @@ pub enum Directive {
QuotedArg,
MultilineArg,
- Meta(Meta),
+ BrokenLinks(BrokenLinks),
Img(Img),
Inline(Inline),
+ Meta(Meta),
PageStats(PageStats),
Tag(Tag),
Toc(Toc),
@@ -45,12 +46,22 @@ 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)?;
+ Self::check_args(
+ &p,
+ Inline::REQUIRED,
+ Inline::ALLOWED,
+ Inline::ALLOW_ANY_UNNAMED,
+ )?;
Directive::Inline(Inline::from(p))
}
"meta" => {
@@ -58,7 +69,12 @@ impl TryFrom<ParsedDirective> for Directive {
Directive::Meta(Meta::from(p))
}
"pagestats" => {
- Self::check_args(&p, PageStats::REQUIRED, PageStats::ALLOWED, PageStats::ALLOW_ANY_UNNAMED)?;
+ Self::check_args(
+ &p,
+ PageStats::REQUIRED,
+ PageStats::ALLOWED,
+ PageStats::ALLOW_ANY_UNNAMED,
+ )?;
Directive::PageStats(PageStats::from(p))
}
"tag" => {
@@ -115,6 +131,7 @@ 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),
@@ -125,6 +142,9 @@ impl Directive {
}
}
+mod brokenlinks;
+use brokenlinks::BrokenLinks;
+
mod meta;
use meta::Meta;