Add search.index_format into the serialized config (#2165) (#2196)

* Add search into the serialized config (#2165)

* Only expose index_format

* Create config.search struct

* cargo fmt
This commit is contained in:
Andrew Langmeier 2023-05-01 15:40:29 -04:00 committed by Vincent Prouillet
parent d72ebb1bdb
commit 8e37025729
2 changed files with 13 additions and 0 deletions

View file

@ -109,6 +109,7 @@ pub struct SerializedConfig<'a> {
build_search_index: bool,
extra: &'a HashMap<String, Toml>,
markdown: &'a markup::Markdown,
search: search::SerializedSearch<'a>,
}
impl Config {
@ -331,6 +332,7 @@ impl Config {
build_search_index: options.build_search_index,
extra: &self.extra,
markdown: &self.markdown,
search: self.search.serialize(),
}
}
}

View file

@ -44,3 +44,14 @@ impl Default for Search {
}
}
}
impl Search {
pub fn serialize(&self) -> SerializedSearch {
SerializedSearch { index_format: &self.index_format }
}
}
#[derive(Serialize)]
pub struct SerializedSearch<'a> {
pub index_format: &'a IndexFormat,
}