From 4f7b96098546331825506c3c05e7c3646d0883f6 Mon Sep 17 00:00:00 2001 From: Songmin Li Date: Mon, 19 Apr 2021 16:33:12 +0800 Subject: [PATCH] Fix can not build with indexing-zh (#1433) * fix can not build zola with search/indexing-zh feature * fix can not build components/utils after enabled indexing-zh feature error[E0252]: the name `Deserialize` is defined multiple times --> components/utils/src/de.rs:2:5 | 1 | use serde::{Deserialize, Deserializer}; | ----------- previous import of the macro `Deserialize` here 2 | use serde_derive::Deserialize; | ^^^^^^^^^^^^^^^^^^^^^^^^^ `Deserialize` reimported here | = note: `Deserialize` must be defined only once in the macro namespace of this module --- Cargo.lock | 2 +- Cargo.toml | 1 + components/utils/Cargo.toml | 3 +-- components/utils/src/de.rs | 1 - components/utils/src/slugs.rs | 2 +- docs/content/documentation/content/multilingual.md | 4 ++-- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 245db215..6c72a084 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3016,7 +3016,6 @@ dependencies = [ "minify-html", "percent-encoding", "serde", - "serde_derive", "slug", "tempfile", "tera", @@ -3325,6 +3324,7 @@ dependencies = [ "percent-encoding", "relative-path", "same-file", + "search", "serde_json", "site", "termcolor", diff --git a/Cargo.toml b/Cargo.toml index 30f897dc..6d47846b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,6 +44,7 @@ site = { path = "components/site" } errors = { path = "components/errors" } front_matter = { path = "components/front_matter" } utils = { path = "components/utils" } +search = { path = "components/search" } [dev-dependencies] same-file = "1" diff --git a/components/utils/Cargo.toml b/components/utils/Cargo.toml index 66bbca8a..d12e0f1a 100644 --- a/components/utils/Cargo.toml +++ b/components/utils/Cargo.toml @@ -10,8 +10,7 @@ tera = "1" unicode-segmentation = "1.2" walkdir = "2" toml = "0.5" -serde = "1" -serde_derive = "1" +serde = { version = "1.0", features = ["derive"] } slug = "0.1" percent-encoding = "2" filetime = "0.2.12" diff --git a/components/utils/src/de.rs b/components/utils/src/de.rs index e294e92a..568d71ad 100644 --- a/components/utils/src/de.rs +++ b/components/utils/src/de.rs @@ -1,5 +1,4 @@ use serde::{Deserialize, Deserializer}; -use serde_derive::Deserialize; use tera::{Map, Value}; /// Used as an attribute when we want to convert from TOML to a string date diff --git a/components/utils/src/slugs.rs b/components/utils/src/slugs.rs index f4ae57e7..d561f89e 100644 --- a/components/utils/src/slugs.rs +++ b/components/utils/src/slugs.rs @@ -1,4 +1,4 @@ -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; #[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] diff --git a/docs/content/documentation/content/multilingual.md b/docs/content/documentation/content/multilingual.md index cd697ff5..5c78c84c 100644 --- a/docs/content/documentation/content/multilingual.md +++ b/docs/content/documentation/content/multilingual.md @@ -21,9 +21,9 @@ If you want to use per-language taxonomies, ensure you set the `lang` field in t configuration. Note: By default, Chinese and Japanese search indexing is not included. You can include -the support by building `zola` using `cargo build --features search/indexing-ja search/indexing-zh`. +the support by building `zola` using `cargo build --features search/indexing-ja --features search/indexing-zh`. Please also note that, enabling Chinese indexing will increase the binary size by approximately -5 MB while enabling Japanese indexing will increase the binary size by approximately 70 MB +5 MB while enabling Japanese indexing will increase the binary size by approximately 70 MB due to the incredibly large dictionaries. ## Content