summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-10-23 11:56:25 +0300
committerLars Wirzenius <liw@liw.fi>2022-10-23 11:56:25 +0300
commitd3e9905b482c6841c9d29dc32a18b3941b90d6bf (patch)
tree3e9b16a95a86d3c1b349aa423a6128cf217c57fd
parent4bf38fbb0374ef4c32bf622e78ba1ec40409d1c2 (diff)
downloadriki-d3e9905b482c6841c9d29dc32a18b3941b90d6bf.tar.gz
drop: unnecessary brokenlinks directive
We already check intrasite links. Site build will fail if a wikilink refers to target that doesn't exist. The brokenlinks directive is thus unnecessary. Sponsored-by: author
-rw-r--r--src/directive/brokenlinks.rs27
-rw-r--r--src/directive/mod.rs14
2 files changed, 0 insertions, 41 deletions
diff --git a/src/directive/brokenlinks.rs b/src/directive/brokenlinks.rs
deleted file mode 100644
index 154ffed..0000000
--- a/src/directive/brokenlinks.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-use crate::error::SiteError;
-use crate::page::PageMeta;
-use crate::site::Site;
-use crate::wikitext::ParsedDirective;
-
-#[derive(Debug, Default, Eq, PartialEq)]
-pub struct BrokenLinks {}
-
-impl BrokenLinks {
- pub const REQUIRED: &'static [&'static str] = &["pages"];
- pub const ALLOWED: &'static [&'static str] = &[];
- pub const ALLOW_ANY_UNNAMED: bool = false;
-
- pub fn new() -> Self {
- Self::default()
- }
-
- pub fn process(&self, _site: &Site, _meta: &mut PageMeta) -> Result<String, SiteError> {
- Err(SiteError::UnimplementedDirective("brokenlinks".into()))
- }
-}
-
-impl From<&ParsedDirective> for BrokenLinks {
- fn from(_p: &ParsedDirective) -> Self {
- Self::new()
- }
-}
diff --git a/src/directive/mod.rs b/src/directive/mod.rs
index 89b5b8a..e33f572 100644
--- a/src/directive/mod.rs
+++ b/src/directive/mod.rs
@@ -14,7 +14,6 @@ pub enum Directive {
QuotedArg,
MultilineArg,
- BrokenLinks(BrokenLinks),
Calendar(Calendar),
Format(Format),
Graph(Graph),
@@ -65,15 +64,6 @@ impl TryFrom<&ParsedDirective> for Directive {
Directive::MultilineArg
}
- "brokenlinks" => {
- Self::check_args(
- p,
- BrokenLinks::REQUIRED,
- BrokenLinks::ALLOWED,
- BrokenLinks::ALLOW_ANY_UNNAMED,
- )?;
- Directive::BrokenLinks(BrokenLinks::from(p))
- }
"calendar" => {
Self::check_args(
p,
@@ -223,7 +213,6 @@ impl Directive {
| Self::MultilineArg => {
panic!("directive {:?} may only be used in parsing tests", self)
}
- Self::BrokenLinks(x) => x.process(site, meta),
Self::Calendar(x) => x.process(site, meta),
Self::Format(x) => x.process(site, meta),
Self::Graph(x) => x.process(site, meta),
@@ -242,9 +231,6 @@ impl Directive {
}
}
-mod brokenlinks;
-use brokenlinks::BrokenLinks;
-
mod format;
use format::Format;