Skip to content

Commit

Permalink
cargo fmt + update
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Prouillet committed Dec 10, 2018
1 parent daf1b4d commit c0bbe16
Show file tree
Hide file tree
Showing 7 changed files with 193 additions and 166 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,7 @@
- Fix pagination for taxonomies being broken and add missing documentation for it
- Add missing pager pages from the sitemap
- Allow and parse full RFC339 datetimes in filenames
- Live reload is now enabled for the 404 page on serve


## 0.5.0 (2018-11-17)
Expand Down
285 changes: 151 additions & 134 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "zola"
version = "0.5.0"
version = "0.5.1"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
license = "MIT"
readme = "README.md"
Expand Down
1 change: 0 additions & 1 deletion components/library/src/content/page.rs
Expand Up @@ -542,7 +542,6 @@ Hello world
assert_eq!(page.slug, "hello");
}


#[test]
fn frontmatter_date_override_filename_date() {
let config = Config::default();
Expand Down
32 changes: 21 additions & 11 deletions components/site/src/lib.rs
Expand Up @@ -628,10 +628,7 @@ impl Site {
let mut context = Context::new();
context.insert("config", &self.config);
let output = render_template("404.html", &self.tera, &context, &self.config.theme)?;
create_file(
&self.output_path.join("404.html"),
&self.inject_livereload(output),
)
create_file(&self.output_path.join("404.html"), &self.inject_livereload(output))
}

/// Renders robots.txt
Expand Down Expand Up @@ -722,10 +719,15 @@ impl Site {
.iter()
.map(|s| SitemapEntry::new(s.permalink.clone(), None))
.collect::<Vec<_>>();
for section in self.library.sections_values().iter().filter(|s| s.meta.paginate_by.is_some()) {
let number_pagers = (section.pages.len() as f64 / section.meta.paginate_by.unwrap() as f64).ceil() as isize;
for i in 1..number_pagers+1 {
let permalink = format!("{}{}/{}/", section.permalink, section.meta.paginate_path, i);
for section in
self.library.sections_values().iter().filter(|s| s.meta.paginate_by.is_some())
{
let number_pagers = (section.pages.len() as f64
/ section.meta.paginate_by.unwrap() as f64)
.ceil() as isize;
for i in 1..number_pagers + 1 {
let permalink =
format!("{}{}/{}/", section.permalink, section.meta.paginate_path, i);
sections.push(SitemapEntry::new(permalink, None))
}
}
Expand All @@ -744,9 +746,17 @@ impl Site {
));

if taxonomy.kind.is_paginated() {
let number_pagers = (item.pages.len() as f64 / taxonomy.kind.paginate_by.unwrap() as f64).ceil() as isize;
for i in 1..number_pagers+1 {
let permalink = self.config.make_permalink(&format!("{}/{}/{}/{}", name, item.slug, taxonomy.kind.paginate_path(), i));
let number_pagers = (item.pages.len() as f64
/ taxonomy.kind.paginate_by.unwrap() as f64)
.ceil() as isize;
for i in 1..number_pagers + 1 {
let permalink = self.config.make_permalink(&format!(
"{}/{}/{}/{}",
name,
item.slug,
taxonomy.kind.paginate_path(),
i
));
terms.push(SitemapEntry::new(permalink, None))
}
}
Expand Down
34 changes: 17 additions & 17 deletions components/templates/src/global_fns/load_data.rs
Expand Up @@ -417,11 +417,11 @@ mod tests {
assert_eq!(
result,
json!({
"category": {
"date": "1979-05-27T07:32:00Z",
"key": "value"
},
})
"category": {
"date": "1979-05-27T07:32:00Z",
"key": "value"
},
})
);
}

Expand All @@ -438,12 +438,12 @@ mod tests {
assert_eq!(
result,
json!({
"headers": ["Number", "Title"],
"records": [
["1", "Gutenberg"],
["2", "Printing"]
],
})
"headers": ["Number", "Title"],
"records": [
["1", "Gutenberg"],
["2", "Printing"]
],
})
)
}

Expand All @@ -460,12 +460,12 @@ mod tests {
assert_eq!(
result,
json!({
"key": "value",
"array": [1, 2, 3],
"subpackage": {
"subkey": 5
}
})
"key": "value",
"array": [1, 2, 3],
"subpackage": {
"subkey": 5
}
})
)
}
}
4 changes: 2 additions & 2 deletions components/templates/src/global_fns/mod.rs
Expand Up @@ -144,7 +144,7 @@ pub fn make_get_taxonomy(all_taxonomies: &[Taxonomy], library: &Library) -> Glob
None => {
return Err(
format!("`get_taxonomy` received an unknown taxonomy as kind: {}", kind).into()
)
);
}
};

Expand Down Expand Up @@ -180,7 +180,7 @@ pub fn make_get_taxonomy_url(all_taxonomies: &[Taxonomy]) -> GlobalFn {
"`get_taxonomy_url` received an unknown taxonomy as kind: {}",
kind
)
.into())
.into());
}
};

Expand Down

0 comments on commit c0bbe16

Please sign in to comment.