diff --git a/src/constants.rs b/src/constants.rs index f90fc34..a11529d 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -2,9 +2,6 @@ pub const FORWARD_SLASH: &str = "/"; pub const EMPTY_STRING: &str = ""; pub const TOML_FENCE: &str = "+++"; pub const YAML_FENCE: &str = "---"; -// TODO: Fix this being super naive. JSON can have nested objects - and will fail here -// pub const JSON_FENCE_OPEN: &str = "{"; -// pub const JSON_FENCE_CLOSE: &str = "}"; pub const MARKDOWN_EXTENSION: &str = "md"; pub const DRAFT: &str = "draft"; diff --git a/src/page_index.rs b/src/page_index.rs index 5b41f20..7788f18 100644 --- a/src/page_index.rs +++ b/src/page_index.rs @@ -69,6 +69,7 @@ impl PageIndex { &file_location.relative_directory_to_content, FORWARD_SLASH, slug, + FORWARD_SLASH, ] .join(EMPTY_STRING); @@ -124,7 +125,7 @@ mod tests { &build_file_location(), ); assert!(page_index.is_ok()); - assert_eq!(page_index.unwrap().href, "/post/my-example-post") + assert_eq!(page_index.unwrap().href, "/post/my-example-post/") } #[test] diff --git a/tests/cli.rs b/tests/cli.rs index 19bb6f6..267fab4 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -300,7 +300,7 @@ tags: let mut buf_reader = BufReader::new(output_file); let mut read_back = String::new(); buf_reader.read_to_string(&mut read_back)?; - let expected = r#"[{"title":"What You Can Achieve In a Year","href":"//what-you-can-achieve-in-a-year","date":"2019-02-15T20:01:39Z","content":"Jon Edmiston\n","tags":["Blog","RSS","Blogging"]}]"#; + let expected = r#"[{"title":"What You Can Achieve In a Year","href":"//what-you-can-achieve-in-a-year/","date":"2019-02-15T20:01:39Z","content":"Jon Edmiston\n","tags":["Blog","RSS","Blogging"]}]"#; assert_eq!(read_back, expected); remove_file(output_file_path)?; @@ -339,7 +339,7 @@ Contents here let mut buf_reader = BufReader::new(output_file); let mut read_back = String::new(); buf_reader.read_to_string(&mut read_back)?; - let expected = r#"[{"title":"Replacing Sed/Awk With Amber","href":"//replacing-awk-sed-with-amber","date":"2019-01-25T07:52:40Z","content":"Contents here","tags":["Rust","Bash","Awk","Sed","Amber","Code Search","Replace","Unix"]}]"#; + let expected = r#"[{"title":"Replacing Sed/Awk With Amber","href":"//replacing-awk-sed-with-amber/","date":"2019-01-25T07:52:40Z","content":"Contents here","tags":["Rust","Bash","Awk","Sed","Amber","Code Search","Replace","Unix"]}]"#; assert_eq!(read_back, expected); remove_file(output_file_path)?;