mirror of
https://github.com/zensical/zensical.git
synced 2026-09-21 22:05:34 +00:00
fix: disabling link validation doesn't disable link and reference collection (#659)
Signed-off-by: squidfunk <martin.donath@squidfunk.com>
This commit is contained in:
@@ -55,6 +55,25 @@ pub struct Validation {
|
||||
pub invalid_link_anchors: bool,
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Implementations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
impl Validation {
|
||||
/// Return whether any validation check is enabled.
|
||||
#[inline]
|
||||
pub fn is_enabled(&self) -> bool {
|
||||
self.unresolved_references
|
||||
|| self.unresolved_footnotes
|
||||
|| self.unused_definitions
|
||||
|| self.unused_footnotes
|
||||
|| self.shadowed_definitions
|
||||
|| self.shadowed_footnotes
|
||||
|| self.invalid_links
|
||||
|| self.invalid_link_anchors
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Trait implementations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -100,9 +100,11 @@ impl Module for Main {
|
||||
let pages = page.select([wait_for_markdown(&self.config)]);
|
||||
|
||||
// Collect all anchors and references from pages, to validate links
|
||||
let references = collect_references(&files);
|
||||
let anchors = collect_anchors(&page);
|
||||
validate(&self.config, self.strict, references, anchors);
|
||||
if self.config.project.validation.is_enabled() {
|
||||
let references = collect_references(&files);
|
||||
let anchors = collect_anchors(&page);
|
||||
validate(&self.config, self.strict, references, anchors);
|
||||
}
|
||||
|
||||
// Generate navigation and search index
|
||||
let nav = generate_nav(&self.config, &pages);
|
||||
|
||||
Reference in New Issue
Block a user