Browse Source

Use Rust 2018 edition (#885)

index-subcmd
Sam Ford Vincent Prouillet 4 years ago
parent
commit
e804f907b2
63 changed files with 96 additions and 292 deletions
  1. +1
    -0
      Cargo.toml
  2. +0
    -3
      build.rs
  3. +1
    -0
      components/config/Cargo.toml
  4. +0
    -1
      components/config/examples/generate_sublime.rs
  5. +4
    -4
      components/config/src/config.rs
  6. +2
    -1
      components/config/src/highlighting.rs
  7. +1
    -14
      components/config/src/lib.rs
  8. +2
    -1
      components/config/src/theme.rs
  9. +1
    -0
      components/errors/Cargo.toml
  10. +0
    -5
      components/errors/src/lib.rs
  11. +1
    -0
      components/front_matter/Cargo.toml
  12. +4
    -15
      components/front_matter/src/lib.rs
  13. +2
    -1
      components/front_matter/src/page.rs
  14. +2
    -1
      components/front_matter/src/section.rs
  15. +1
    -0
      components/imageproc/Cargo.toml
  16. +1
    -9
      components/imageproc/src/lib.rs
  17. +1
    -0
      components/library/Cargo.toml
  18. +1
    -1
      components/library/src/content/file_info.rs
  19. +5
    -4
      components/library/src/content/page.rs
  20. +4
    -4
      components/library/src/content/section.rs
  21. +3
    -2
      components/library/src/content/ser.rs
  22. +1
    -26
      components/library/src/lib.rs
  23. +2
    -2
      components/library/src/library.rs
  24. +7
    -6
      components/library/src/pagination/mod.rs
  25. +2
    -2
      components/library/src/sorting.rs
  26. +7
    -6
      components/library/src/taxonomies/mod.rs
  27. +1
    -0
      components/link_checker/Cargo.toml
  28. +1
    -7
      components/link_checker/src/lib.rs
  29. +1
    -0
      components/rebuild/Cargo.toml
  30. +1
    -7
      components/rebuild/src/lib.rs
  31. +0
    -5
      components/rebuild/tests/rebuild.rs
  32. +1
    -0
      components/rendering/Cargo.toml
  33. +0
    -8
      components/rendering/benches/all.rs
  34. +0
    -23
      components/rendering/src/lib.rs
  35. +3
    -2
      components/rendering/src/markdown.rs
  36. +4
    -2
      components/rendering/src/shortcode.rs
  37. +2
    -0
      components/rendering/src/table_of_contents.rs
  38. +0
    -6
      components/rendering/tests/markdown.rs
  39. +1
    -0
      components/search/Cargo.toml
  40. +2
    -10
      components/search/src/lib.rs
  41. +1
    -0
      components/site/Cargo.toml
  42. +0
    -5
      components/site/benches/load.rs
  43. +0
    -6
      components/site/benches/site.rs
  44. +1
    -23
      components/site/src/lib.rs
  45. +2
    -0
      components/site/src/sitemap.rs
  46. +2
    -5
      components/site/tests/common.rs
  47. +0
    -2
      components/site/tests/site.rs
  48. +0
    -1
      components/site/tests/site_i18n.rs
  49. +1
    -0
      components/templates/Cargo.toml
  50. +1
    -1
      components/templates/src/filters.rs
  51. +1
    -3
      components/templates/src/global_fns/load_data.rs
  52. +1
    -22
      components/templates/src/lib.rs
  53. +1
    -0
      components/utils/Cargo.toml
  54. +0
    -12
      components/utils/src/lib.rs
  55. +1
    -1
      components/utils/src/site.rs
  56. +1
    -1
      components/utils/src/templates.rs
  57. +1
    -1
      src/cli.rs
  58. +1
    -1
      src/cmd/build.rs
  59. +1
    -1
      src/cmd/check.rs
  60. +3
    -3
      src/cmd/init.rs
  61. +2
    -4
      src/cmd/serve.rs
  62. +2
    -0
      src/console.rs
  63. +0
    -22
      src/main.rs

+ 1
- 0
Cargo.toml View File

@@ -2,6 +2,7 @@
name = "zola"
version = "0.10.0"
authors = ["Vincent Prouillet <hello@vincentprouillet.com>"]
edition = "2018"
license = "MIT"
readme = "README.md"
description = "A fast static site generator with everything built-in"


+ 0
- 3
build.rs View File

@@ -1,6 +1,3 @@
#[macro_use]
extern crate clap;

// use clap::Shell;

include!("src/cli.rs");


+ 1
- 0
components/config/Cargo.toml View File

@@ -2,6 +2,7 @@
name = "config"
version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
edition = "2018"

[dependencies]
toml = "0.5"


+ 0
- 1
components/config/examples/generate_sublime.rs View File

@@ -2,7 +2,6 @@
//! syntect, not as a helpful example for beginners.
//! Although it is a valid example for serializing syntaxes, you probably won't need
//! to do this yourself unless you want to cache your own compiled grammars.
extern crate syntect;

use std::collections::HashMap;
use std::collections::HashSet;


+ 4
- 4
components/config/src/config.rs View File

@@ -3,14 +3,14 @@ use std::path::{Path, PathBuf};

use chrono::Utc;
use globset::{Glob, GlobSet, GlobSetBuilder};
use serde_derive::{Deserialize, Serialize};
use syntect::parsing::{SyntaxSet, SyntaxSetBuilder};
use toml;
use toml::Value as Toml;

use errors::Error;
use errors::Result;
use highlighting::THEME_SET;
use theme::Theme;
use crate::highlighting::THEME_SET;
use crate::theme::Theme;
use errors::{bail, Error, Result};
use utils::fs::read_file_with_error;

// We want a default base url for tests


+ 2
- 1
components/config/src/highlighting.rs View File

@@ -1,9 +1,10 @@
use lazy_static::lazy_static;
use syntect::dumps::from_binary;
use syntect::easy::HighlightLines;
use syntect::highlighting::ThemeSet;
use syntect::parsing::SyntaxSet;

use Config;
use crate::config::Config;

lazy_static! {
pub static ref SYNTAX_SET: SyntaxSet = {


+ 1
- 14
components/config/src/lib.rs View File

@@ -1,20 +1,7 @@
#[macro_use]
extern crate serde_derive;
extern crate chrono;
extern crate globset;
extern crate toml;
#[macro_use]
extern crate lazy_static;
extern crate syntect;

#[macro_use]
extern crate errors;
extern crate utils;

mod config;
pub mod highlighting;
mod theme;
pub use config::{Config, Language, LinkChecker, Taxonomy};
pub use crate::config::{Config, Language, LinkChecker, Taxonomy};

use std::path::Path;



+ 2
- 1
components/config/src/theme.rs View File

@@ -1,9 +1,10 @@
use std::collections::HashMap;
use std::path::PathBuf;

use serde_derive::{Deserialize, Serialize};
use toml::Value as Toml;

use errors::Result;
use errors::{bail, Result};
use utils::fs::read_file_with_error;

/// Holds the data from a `theme.toml` file.


+ 1
- 0
components/errors/Cargo.toml View File

@@ -2,6 +2,7 @@
name = "errors"
version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
edition = "2018"

[dependencies]
tera = "1"


+ 0
- 5
components/errors/src/lib.rs View File

@@ -1,8 +1,3 @@
extern crate image;
extern crate syntect;
extern crate tera;
extern crate toml;

use std::convert::Into;
use std::error::Error as StdError;
use std::fmt;


+ 1
- 0
components/front_matter/Cargo.toml View File

@@ -2,6 +2,7 @@
name = "front_matter"
version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
edition = "2018"

[dependencies]
tera = "1"


+ 4
- 15
components/front_matter/src/lib.rs View File

@@ -1,18 +1,7 @@
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate serde_derive;
extern crate chrono;
extern crate regex;
extern crate serde;
extern crate tera;
extern crate toml;

#[macro_use]
extern crate errors;
extern crate utils;

use errors::{Error, Result};
use lazy_static::lazy_static;
use serde_derive::{Deserialize, Serialize};

use errors::{bail, Error, Result};
use regex::Regex;
use std::path::Path;



+ 2
- 1
components/front_matter/src/page.rs View File

@@ -1,10 +1,11 @@
use std::collections::HashMap;

use chrono::prelude::*;
use serde_derive::Deserialize;
use tera::{Map, Value};
use toml;

use errors::Result;
use errors::{bail, Result};
use utils::de::{fix_toml_dates, from_toml_datetime};

/// The front matter of every page


+ 2
- 1
components/front_matter/src/section.rs View File

@@ -1,8 +1,9 @@
use serde_derive::{Deserialize, Serialize};
use tera::{Map, Value};
use toml;

use super::{InsertAnchor, SortBy};
use errors::Result;
use errors::{bail, Result};
use utils::de::fix_toml_dates;

static DEFAULT_PAGINATE_PATH: &str = "page";


+ 1
- 0
components/imageproc/Cargo.toml View File

@@ -2,6 +2,7 @@
name = "imageproc"
version = "0.1.0"
authors = ["Vojtěch Král <vojtech@kral.hk>"]
edition = "2018"

[dependencies]
lazy_static = "1"


+ 1
- 9
components/imageproc/src/lib.rs View File

@@ -1,12 +1,3 @@
#[macro_use]
extern crate lazy_static;
extern crate image;
extern crate rayon;
extern crate regex;

extern crate errors;
extern crate utils;

use std::collections::hash_map::DefaultHasher;
use std::collections::hash_map::Entry as HEntry;
use std::collections::HashMap;
@@ -17,6 +8,7 @@ use std::path::{Path, PathBuf};
use image::jpeg::JPEGEncoder;
use image::png::PNGEncoder;
use image::{FilterType, GenericImageView};
use lazy_static::lazy_static;
use rayon::prelude::*;
use regex::Regex;



+ 1
- 0
components/library/Cargo.toml View File

@@ -2,6 +2,7 @@
name = "library"
version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
edition = "2018"

[dependencies]
slotmap = "0.4"


+ 1
- 1
components/library/src/content/file_info.rs View File

@@ -1,7 +1,7 @@
use std::path::{Path, PathBuf};

use config::Config;
use errors::Result;
use errors::{bail, Result};

/// Takes a full path to a file and returns only the components after the first `content` directory
/// Will not return the filename as last component


+ 5
- 4
components/library/src/content/page.rs View File

@@ -2,22 +2,23 @@
use std::collections::HashMap;
use std::path::{Path, PathBuf};

use lazy_static::lazy_static;
use regex::Regex;
use slotmap::DefaultKey;
use tera::{Context as TeraContext, Tera};

use crate::library::Library;
use config::Config;
use errors::{Error, Result};
use front_matter::{split_page_content, InsertAnchor, PageFrontMatter};
use library::Library;
use rendering::{render_content, Heading, RenderContext};
use utils::fs::{find_related_assets, read_file};
use utils::site::get_reading_analytics;
use utils::templates::render_template;

use content::file_info::FileInfo;
use content::has_anchor;
use content::ser::SerializingPage;
use crate::content::file_info::FileInfo;
use crate::content::has_anchor;
use crate::content::ser::SerializingPage;
use utils::slugs::maybe_slugify_paths;

lazy_static! {


+ 4
- 4
components/library/src/content/section.rs View File

@@ -12,10 +12,10 @@ use utils::fs::{find_related_assets, read_file};
use utils::site::get_reading_analytics;
use utils::templates::render_template;

use content::file_info::FileInfo;
use content::has_anchor;
use content::ser::SerializingSection;
use library::Library;
use crate::content::file_info::FileInfo;
use crate::content::has_anchor;
use crate::content::ser::SerializingSection;
use crate::library::Library;

#[derive(Clone, Debug, PartialEq)]
pub struct Section {


+ 3
- 2
components/library/src/content/ser.rs View File

@@ -2,10 +2,11 @@
use std::collections::HashMap;
use std::path::Path;

use serde_derive::Serialize;
use tera::{Map, Value};

use content::{Page, Section};
use library::Library;
use crate::content::{Page, Section};
use crate::library::Library;
use rendering::Heading;

#[derive(Clone, Debug, PartialEq, Serialize)]


+ 1
- 26
components/library/src/lib.rs View File

@@ -1,28 +1,3 @@
extern crate serde;
extern crate tera;
#[macro_use]
extern crate serde_derive;
extern crate chrono;
extern crate rayon;
extern crate slotmap;
#[macro_use]
extern crate lazy_static;
extern crate regex;

#[cfg(test)]
extern crate globset;
#[cfg(test)]
extern crate tempfile;
#[cfg(test)]
extern crate toml;

extern crate config;
extern crate front_matter;
extern crate rendering;
extern crate utils;
#[macro_use]
extern crate errors;

mod content;
mod library;
mod pagination;
@@ -31,8 +6,8 @@ mod taxonomies;

pub use slotmap::{DenseSlotMap, Key};

pub use crate::library::Library;
pub use content::{Page, Section, SerializingPage, SerializingSection};
pub use library::Library;
pub use pagination::Paginator;
pub use sorting::sort_actual_pages_by_date;
pub use taxonomies::{find_taxonomies, Taxonomy, TaxonomyItem};

+ 2
- 2
components/library/src/library.rs View File

@@ -5,9 +5,9 @@ use slotmap::{DefaultKey, DenseSlotMap};

use front_matter::SortBy;

use crate::content::{Page, Section};
use crate::sorting::{find_siblings, sort_pages_by_date, sort_pages_by_weight};
use config::Config;
use content::{Page, Section};
use sorting::{find_siblings, sort_pages_by_date, sort_pages_by_weight};

// Like vec! but for HashSet
macro_rules! set {


+ 7
- 6
components/library/src/pagination/mod.rs View File

@@ -1,5 +1,6 @@
use std::collections::HashMap;

use serde_derive::Serialize;
use slotmap::DefaultKey;
use tera::{to_value, Context, Tera, Value};

@@ -7,9 +8,9 @@ use config::Config;
use errors::{Error, Result};
use utils::templates::render_template;

use content::{Section, SerializingPage, SerializingSection};
use library::Library;
use taxonomies::{Taxonomy, TaxonomyItem};
use crate::content::{Section, SerializingPage, SerializingSection};
use crate::library::Library;
use crate::taxonomies::{Taxonomy, TaxonomyItem};

#[derive(Clone, Debug, PartialEq)]
enum PaginationRoot<'a> {
@@ -240,11 +241,11 @@ mod tests {
use std::path::PathBuf;
use tera::to_value;

use crate::content::{Page, Section};
use crate::library::Library;
use crate::taxonomies::{Taxonomy, TaxonomyItem};
use config::Taxonomy as TaxonomyConfig;
use content::{Page, Section};
use front_matter::SectionFrontMatter;
use library::Library;
use taxonomies::{Taxonomy, TaxonomyItem};

use super::Paginator;



+ 2
- 2
components/library/src/sorting.rs View File

@@ -4,7 +4,7 @@ use chrono::NaiveDateTime;
use rayon::prelude::*;
use slotmap::DefaultKey;

use content::Page;
use crate::content::Page;

/// Used by the RSS feed
/// There to not have to import sorting stuff in the site crate
@@ -91,7 +91,7 @@ mod tests {
use std::path::PathBuf;

use super::{find_siblings, sort_pages_by_date, sort_pages_by_weight};
use content::Page;
use crate::content::Page;
use front_matter::PageFrontMatter;

fn create_page_with_date(date: &str) -> Page {


+ 7
- 6
components/library/src/taxonomies/mod.rs View File

@@ -1,16 +1,17 @@
use std::collections::HashMap;

use serde_derive::Serialize;
use slotmap::DefaultKey;
use tera::{Context, Tera};

use config::{Config, Taxonomy as TaxonomyConfig};
use errors::{Error, Result};
use errors::{bail, Error, Result};
use utils::templates::render_template;

use content::SerializingPage;
use library::Library;
use crate::content::SerializingPage;
use crate::library::Library;
use crate::sorting::sort_pages_by_date;
use utils::slugs::maybe_slugify_paths;
use sorting::sort_pages_by_date;

#[derive(Debug, Clone, PartialEq, Serialize)]
pub struct SerializedTaxonomyItem<'a> {
@@ -231,9 +232,9 @@ mod tests {
use super::*;
use std::collections::HashMap;

use crate::content::Page;
use crate::library::Library;
use config::{Config, Language, Taxonomy as TaxonomyConfig};
use content::Page;
use library::Library;

#[test]
fn can_make_taxonomies() {


+ 1
- 0
components/link_checker/Cargo.toml View File

@@ -2,6 +2,7 @@
name = "link_checker"
version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
edition = "2018"

[dependencies]
reqwest = "0.9"


+ 1
- 7
components/link_checker/src/lib.rs View File

@@ -1,10 +1,4 @@
extern crate reqwest;
#[macro_use]
extern crate lazy_static;

extern crate config;
extern crate errors;

use lazy_static::lazy_static;
use reqwest::header::{HeaderMap, ACCEPT};
use reqwest::StatusCode;



+ 1
- 0
components/rebuild/Cargo.toml View File

@@ -2,6 +2,7 @@
name = "rebuild"
version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
edition = "2018"

[dependencies]
errors = { path = "../errors" }


+ 1
- 7
components/rebuild/src/lib.rs View File

@@ -1,12 +1,6 @@
extern crate site;
#[macro_use]
extern crate errors;
extern crate front_matter;
extern crate library;

use std::path::{Component, Path};

use errors::Result;
use errors::{bail, Result};
use front_matter::{PageFrontMatter, SectionFrontMatter};
use library::{Page, Section};
use site::Site;


+ 0
- 5
components/rebuild/tests/rebuild.rs View File

@@ -1,8 +1,3 @@
extern crate fs_extra;
extern crate rebuild;
extern crate site;
extern crate tempfile;

use std::env;
use std::fs::{self, File};
use std::io::prelude::*;


+ 1
- 0
components/rendering/Cargo.toml View File

@@ -2,6 +2,7 @@
name = "rendering"
version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
edition = "2018"

[dependencies]
tera = { version = "1", features = ["preserve_order"] }


+ 0
- 8
components/rendering/benches/all.rs View File

@@ -1,11 +1,3 @@
#![feature(test)]
extern crate tera;
extern crate test;

extern crate config;
extern crate front_matter;
extern crate rendering;

use std::collections::HashMap;
use std::path::Path;



+ 0
- 23
components/rendering/src/lib.rs View File

@@ -1,26 +1,3 @@
extern crate pulldown_cmark;
extern crate syntect;
extern crate tera;
#[macro_use]
extern crate serde_derive;
extern crate pest;
extern crate serde;
#[macro_use]
extern crate pest_derive;
extern crate regex;
#[macro_use]
extern crate lazy_static;

#[macro_use]
extern crate errors;
extern crate config;
extern crate front_matter;
extern crate link_checker;
extern crate utils;

#[cfg(test)]
extern crate templates;

mod context;
mod markdown;
mod shortcode;


+ 3
- 2
components/rendering/src/markdown.rs View File

@@ -1,3 +1,4 @@
use lazy_static::lazy_static;
use pulldown_cmark as cmark;
use regex::Regex;
use syntect::easy::HighlightLines;
@@ -5,11 +6,11 @@ use syntect::html::{
start_highlighted_html_snippet, styled_line_to_highlighted_html, IncludeBackground,
};

use crate::context::RenderContext;
use crate::table_of_contents::{make_table_of_contents, Heading};
use config::highlighting::{get_highlighter, SYNTAX_SET, THEME_SET};
use context::RenderContext;
use errors::{Error, Result};
use front_matter::InsertAnchor;
use table_of_contents::{make_table_of_contents, Heading};
use utils::site::resolve_internal_link;
use utils::vec::InsertMany;
use utils::slugs::maybe_slugify_anchors;


+ 4
- 2
components/rendering/src/shortcode.rs View File

@@ -1,10 +1,12 @@
use lazy_static::lazy_static;
use pest::iterators::Pair;
use pest::Parser;
use pest_derive::Parser;
use regex::Regex;
use tera::{to_value, Context, Map, Value};

use context::RenderContext;
use errors::{Error, Result};
use crate::context::RenderContext;
use errors::{bail, Error, Result};

// This include forces recompiling this source file if the grammar file changes.
// Uncomment it when doing changes to the .pest file


+ 2
- 0
components/rendering/src/table_of_contents.rs View File

@@ -1,3 +1,5 @@
use serde_derive::Serialize;

/// Populated while receiving events from the markdown parser
#[derive(Debug, PartialEq, Clone, Serialize)]
pub struct Heading {


+ 0
- 6
components/rendering/tests/markdown.rs View File

@@ -1,9 +1,3 @@
extern crate config;
extern crate front_matter;
extern crate rendering;
extern crate templates;
extern crate tera;

use std::collections::HashMap;

use tera::Tera;


+ 1
- 0
components/search/Cargo.toml View File

@@ -2,6 +2,7 @@
name = "search"
version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
edition = "2018"

[dependencies]
elasticlunr-rs = "2"


+ 2
- 10
components/search/src/lib.rs View File

@@ -1,17 +1,9 @@
extern crate elasticlunr;
#[macro_use]
extern crate lazy_static;
extern crate ammonia;

#[macro_use]
extern crate errors;
extern crate library;

use std::collections::{HashMap, HashSet};

use elasticlunr::{Index, Language};
use lazy_static::lazy_static;

use errors::Result;
use errors::{bail, Result};
use library::{Library, Section};

pub const ELASTICLUNR_JS: &str = include_str!("elasticlunr.min.js");


+ 1
- 0
components/site/Cargo.toml View File

@@ -2,6 +2,7 @@
name = "site"
version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
edition = "2018"

[dependencies]
tera = "1"


+ 0
- 5
components/site/benches/load.rs View File

@@ -1,9 +1,4 @@
//! Benchmarking loading/markdown rendering of generated sites of various sizes

#![feature(test)]
extern crate site;
extern crate test;

use std::env;

use site::Site;


+ 0
- 6
components/site/benches/site.rs View File

@@ -1,9 +1,3 @@
#![feature(test)]
extern crate library;
extern crate site;
extern crate tempfile;
extern crate test;

use std::env;

use library::Paginator;


+ 1
- 23
components/site/src/lib.rs View File

@@ -1,25 +1,3 @@
extern crate glob;
extern crate rayon;
extern crate serde;
extern crate tera;
#[macro_use]
extern crate serde_derive;
extern crate sass_rs;

#[macro_use]
extern crate errors;
extern crate config;
extern crate front_matter;
extern crate imageproc;
extern crate library;
extern crate link_checker;
extern crate search;
extern crate templates;
extern crate utils;

#[cfg(test)]
extern crate tempfile;

pub mod sitemap;

use std::collections::HashMap;
@@ -33,7 +11,7 @@ use sass_rs::{compile_file, Options as SassOptions, OutputStyle};
use tera::{Context, Tera};

use config::{get_config, Config};
use errors::{Error, ErrorKind, Result};
use errors::{bail, Error, ErrorKind, Result};
use front_matter::InsertAnchor;
use library::{
find_taxonomies, sort_actual_pages_by_date, Library, Page, Paginator, Section, Taxonomy,


+ 2
- 0
components/site/src/sitemap.rs View File

@@ -2,6 +2,8 @@ use std::borrow::Cow;
use std::collections::HashSet;
use std::hash::{Hash, Hasher};

use serde_derive::Serialize;

use config::Config;
use library::{Library, Taxonomy};
use std::cmp::Ordering;


+ 2
- 5
components/site/tests/common.rs View File

@@ -1,11 +1,8 @@
extern crate site;
extern crate tempfile;

use std::env;
use std::path::PathBuf;

use self::site::Site;
use self::tempfile::{tempdir, TempDir};
use site::Site;
use tempfile::{tempdir, TempDir};

// 2 helper macros to make all the build testing more bearable
#[macro_export]


+ 0
- 2
components/site/tests/site.rs View File

@@ -1,5 +1,3 @@
extern crate config;
extern crate site;
mod common;

use std::collections::HashMap;


+ 0
- 1
components/site/tests/site_i18n.rs View File

@@ -1,4 +1,3 @@
extern crate site;
mod common;

use std::env;


+ 1
- 0
components/templates/Cargo.toml View File

@@ -2,6 +2,7 @@
name = "templates"
version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
edition = "2018"

[dependencies]
tera = "1"


+ 1
- 1
components/templates/src/filters.rs View File

@@ -3,7 +3,7 @@ use std::hash::BuildHasher;

use base64::{decode, encode};
use pulldown_cmark as cmark;
use tera::{to_value, Result as TeraResult, Value};
use tera::{to_value, try_get_value, Result as TeraResult, Value};

pub fn markdown<S: BuildHasher>(
value: &Value,


+ 1
- 3
components/templates/src/global_fns/load_data.rs View File

@@ -1,6 +1,3 @@
extern crate serde_json;
extern crate toml;

use utils::de::fix_toml_dates;
use utils::fs::{get_file_time, is_path_in_directory, read_file};

@@ -324,6 +321,7 @@ mod tests {
use std::collections::HashMap;
use std::path::PathBuf;

use serde_json::json;
use tera::{to_value, Function};

fn get_test_file(filename: &str) -> PathBuf {


+ 1
- 22
components/templates/src/lib.rs View File

@@ -1,28 +1,7 @@
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate tera;
extern crate base64;
extern crate csv;
extern crate image;
extern crate pulldown_cmark;
extern crate reqwest;
extern crate url;
#[cfg(test)]
#[macro_use]
extern crate serde_json;
#[cfg(not(test))]
extern crate serde_json;

extern crate config;
extern crate errors;
extern crate imageproc;
extern crate library;
extern crate utils;

pub mod filters;
pub mod global_fns;

use lazy_static::lazy_static;
use tera::{Context, Tera};

use errors::{Error, Result};


+ 1
- 0
components/utils/Cargo.toml View File

@@ -2,6 +2,7 @@
name = "utils"
version = "0.1.0"
authors = ["Vincent Prouillet <prouillet.vincent@gmail.com>"]
edition = "2018"

[dependencies]
errors = { path = "../errors" }


+ 0
- 12
components/utils/src/lib.rs View File

@@ -1,15 +1,3 @@
#[macro_use]
extern crate errors;

extern crate serde;
#[cfg(test)]
extern crate tempfile;
extern crate tera;
extern crate toml;
extern crate unicode_segmentation;
extern crate walkdir;
extern crate slug;

pub mod de;
pub mod fs;
pub mod net;


+ 1
- 1
components/utils/src/site.rs View File

@@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::hash::BuildHasher;
use unicode_segmentation::UnicodeSegmentation;

use errors::Result;
use errors::{bail, Result};

/// Get word count and estimated reading time
pub fn get_reading_analytics(content: &str) -> (usize, usize) {


+ 1
- 1
components/utils/src/templates.rs View File

@@ -2,7 +2,7 @@ use std::collections::HashMap;

use tera::{Context, Tera};

use errors::Result;
use errors::{bail, Result};

static DEFAULT_TPL: &str = include_str!("default_tpl.html");



+ 1
- 1
src/cli.rs View File

@@ -1,4 +1,4 @@
use clap::{App, AppSettings, Arg, SubCommand};
use clap::{crate_authors, crate_description, crate_version, App, AppSettings, Arg, SubCommand};

pub fn build_cli() -> App<'static, 'static> {
App::new("zola")


+ 1
- 1
src/cmd/build.rs View File

@@ -3,7 +3,7 @@ use std::env;
use errors::Result;
use site::Site;

use console;
use crate::console;

pub fn build(
config_file: &str,


+ 1
- 1
src/cmd/check.rs View File

@@ -4,7 +4,7 @@ use std::path::PathBuf;
use errors::Result;
use site::Site;

use console;
use crate::console;

pub fn check(
config_file: &str,


+ 3
- 3
src/cmd/init.rs View File

@@ -1,11 +1,11 @@
use std::fs::{canonicalize, create_dir};
use std::path::Path;

use errors::Result;
use errors::{bail, Result};
use utils::fs::create_file;

use console;
use prompt::{ask_bool, ask_url};
use crate::console;
use crate::prompt::{ask_bool, ask_url};

const CONFIG: &str = r#"
# The URL the site will be built for


+ 2
- 4
src/cmd/serve.rs View File

@@ -21,8 +21,6 @@
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

extern crate globset;

use std::env;
use std::fs::{read_dir, remove_dir_all, File};
use std::io::Read;
@@ -39,12 +37,12 @@ use ctrlc;
use notify::{watcher, RecursiveMode, Watcher};
use ws::{Message, Sender, WebSocket};

use cmd::serve::globset::GlobSet;
use errors::{Error as ZolaError, Result};
use globset::GlobSet;
use site::Site;
use utils::fs::copy_file;

use console;
use crate::console;
use open;
use rebuild;



+ 2
- 0
src/console.rs View File

@@ -1,3 +1,5 @@
use lazy_static::lazy_static;

use std::env;
use std::error::Error as StdError;
use std::io::Write;


+ 0
- 22
src/main.rs View File

@@ -1,25 +1,3 @@
extern crate actix_files;
extern crate actix_web;
extern crate atty;
#[macro_use]
extern crate clap;
extern crate chrono;
#[macro_use]
extern crate lazy_static;
extern crate ctrlc;
extern crate notify;
extern crate termcolor;
extern crate url;
extern crate ws;

extern crate site;
#[macro_use]
extern crate errors;
extern crate front_matter;
extern crate open;
extern crate rebuild;
extern crate utils;

use std::time::Instant;

use utils::net::{get_available_port, port_is_available};


Loading…
Cancel
Save