summary history branches tags files
commit:51007c68b894a9adce76bd3016b005f324d57594
author:Trevor Bentley
committer:Trevor Bentley
date:Thu Jan 12 21:02:59 2023 +0100
parents:99cdc02af592c8724cb2672d380865990631fe60
cargo fmt
diff --git a/src/generate.rs b/src/generate.rs
line changes: +16/-15
index 7a86297..04a1e2b
--- a/src/generate.rs
+++ b/src/generate.rs
@@ -132,8 +132,9 @@ impl GitsyGenerator {
             self.settings.outputs.path.display()
         ));
         let canonical_path = PathBuf::from(path);
-        let has_relative_dirs = canonical_path.ancestors().any(|x| x.file_name().is_none() &&
-                                                               x != Path::new("/"));
+        let has_relative_dirs = canonical_path
+            .ancestors()
+            .any(|x| x.file_name().is_none() && x != Path::new("/"));
         assert!(
             canonical_path.is_absolute(),
             "ERROR: write_rendered called with a relative path: {}",
@@ -347,13 +348,14 @@ impl GitsyGenerator {
             if let Some(templ_file) = self.settings.templates.branches.as_deref() {
                 let mut paged_ctx = local_ctx.clone();
                 paged_ctx.remove("branches");
-                let pages = summary
-                    .branches
-                    .chunks(self.settings.paginate_branches());
+                let pages = summary.branches.chunks(self.settings.paginate_branches());
                 let page_count = pages.len();
                 for (idx, page) in pages.enumerate() {
-                    let pagination =
-                        Pagination::new(idx + 1, page_count, &self.settings.outputs.branches(Some(&summary), None));
+                    let pagination = Pagination::new(
+                        idx + 1,
+                        page_count,
+                        &self.settings.outputs.branches(Some(&summary), None),
+                    );
                     paged_ctx.insert("page", &pagination.with_relative_paths());
                     paged_ctx.insert("branches", &page);
                     match tera.render(templ_file, &paged_ctx) {
@@ -389,9 +391,7 @@ impl GitsyGenerator {
             if let Some(templ_file) = self.settings.templates.tags.as_deref() {
                 let mut paged_ctx = local_ctx.clone();
                 paged_ctx.remove("tags");
-                let pages = summary
-                    .tags
-                    .chunks(self.settings.paginate_tags());
+                let pages = summary.tags.chunks(self.settings.paginate_tags());
                 let page_count = pages.len();
                 for (idx, page) in pages.enumerate() {
                     let pagination =
@@ -437,13 +437,14 @@ impl GitsyGenerator {
             if let Some(templ_file) = self.settings.templates.history.as_deref() {
                 let mut paged_ctx = local_ctx.clone();
                 paged_ctx.remove("history");
-                let pages = summary
-                    .history
-                    .chunks(self.settings.paginate_history());
+                let pages = summary.history.chunks(self.settings.paginate_history());
                 let page_count = pages.len();
                 for (idx, page) in pages.enumerate() {
-                    let pagination =
-                        Pagination::new(idx + 1, page_count, &self.settings.outputs.history(Some(&summary), None));
+                    let pagination = Pagination::new(
+                        idx + 1,
+                        page_count,
+                        &self.settings.outputs.history(Some(&summary), None),
+                    );
                     paged_ctx.insert("page", &pagination.with_relative_paths());
                     paged_ctx.insert("history", &page);
                     match tera.render(templ_file, &paged_ctx) {

diff --git a/src/settings.rs b/src/settings.rs
line changes: +4/-2
index 320927b..9c11833
--- a/src/settings.rs
+++ b/src/settings.rs
@@ -126,8 +126,10 @@ macro_rules! output_path_fn {
                 _ => tmpl_str,
             };
             let tmpl = PathBuf::from(tmpl_str);
-            let mut path = self.path.clone().canonicalize()
-                .expect(&format!("ERROR: unable to canonicalize output path: {}", self.path.display()));
+            let mut path = self.path.clone().canonicalize().expect(&format!(
+                "ERROR: unable to canonicalize output path: {}",
+                self.path.display()
+            ));
             path.push(tmpl);
             match $is_dir {
                 true => {