Browse Source

Avoid the use of enumerate in render_paginated

index-subcmd
Vincent Prouillet 6 years ago
parent
commit
ccaf36ee94
2 changed files with 4 additions and 5 deletions
  1. +1
    -1
      components/pagination/src/lib.rs
  2. +3
    -4
      components/site/src/lib.rs

+ 1
- 1
components/pagination/src/lib.rs View File

@@ -33,7 +33,7 @@ enum PaginationRoot<'a> {
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct Pager<'a> {
/// The page number in the paginator (1-indexed)
index: usize,
pub index: usize,
/// Permalink to that page
permalink: String,
/// Path to that page


+ 3
- 4
components/site/src/lib.rs View File

@@ -905,12 +905,11 @@ impl Site {
paginator
.pagers
.par_iter()
.enumerate()
.map(|(i, pager)| {
let page_path = folder_path.join(&format!("{}", i + 1));
.map(|pager| {
let page_path = folder_path.join(&format!("{}", pager.index));
create_directory(&page_path)?;
let output = paginator.render_pager(pager, &self.config, &self.tera)?;
if i > 0 {
if pager.index > 1 {
create_file(&page_path.join("index.html"), &self.inject_livereload(output))?;
} else {
create_file(&output_path.join("index.html"), &self.inject_livereload(output))?;


Loading…
Cancel
Save