summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 2950ee9..a41f801 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,6 +8,8 @@ pub use generate_html::*;
use markdown::*;
use vagabond::*;
+use std::collections::HashSet;
+
const NORMAL: &str = "\x1b[0m";
const BOLD: &str = "\x1b[1m";
@@ -55,6 +57,25 @@ fn main() {
let website = Website::from_path(&source_directory);
+ // Check for duplicate output paths for pages.
+ let mut destinations: HashSet<&str> = HashSet::new();
+ let mut duplicates: HashSet<&str> = HashSet::new();
+ for page in &website.pages {
+ if !destinations.insert(&page.full_url) {
+ duplicates.insert(&page.full_url);
+ };
+ }
+ if !duplicates.is_empty() {
+ for destination in duplicates {
+ warn!("Multiple pages have the output path {destination:?}");
+ for page in &website.pages {
+ if page.full_url == destination {
+ eprintln!(":: {:?}", page.source_path);
+ }
+ }
+ }
+ }
+
let mut destination = destination_directory.clone();
destination.push(make_url_safe(&website.name));
@@ -64,6 +85,7 @@ fn main() {
error!("Failed to delete existing destination directory {destination:?}"));
}
+
for page in &website.pages {
let mut destination = destination.clone();
destination.push(&page.full_url);