|
@@ -254,23 +254,21 @@ impl<'a> SerializingSection<'a> { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// Same as from_section but doesn't fetch pages and sections |
|
|
|
|
|
|
|
|
/// Same as from_section but doesn't fetch pages |
|
|
pub fn from_section_basic(section: &'a Section, library: Option<&'a Library>) -> Self { |
|
|
pub fn from_section_basic(section: &'a Section, library: Option<&'a Library>) -> Self { |
|
|
let ancestors = if let Some(ref lib) = library { |
|
|
|
|
|
section |
|
|
|
|
|
|
|
|
let mut ancestors = vec![]; |
|
|
|
|
|
let mut translations = vec![]; |
|
|
|
|
|
let mut subsections = vec![]; |
|
|
|
|
|
if let Some(ref lib) = library { |
|
|
|
|
|
ancestors = section |
|
|
.ancestors |
|
|
.ancestors |
|
|
.iter() |
|
|
.iter() |
|
|
.map(|k| lib.get_section_by_key(*k).file.relative.clone()) |
|
|
.map(|k| lib.get_section_by_key(*k).file.relative.clone()) |
|
|
.collect() |
|
|
|
|
|
} else { |
|
|
|
|
|
vec![] |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
let translations = if let Some(ref lib) = library { |
|
|
|
|
|
TranslatedContent::find_all_sections(section, lib) |
|
|
|
|
|
} else { |
|
|
|
|
|
vec![] |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
.collect(); |
|
|
|
|
|
translations = TranslatedContent::find_all_sections(section, lib); |
|
|
|
|
|
subsections = |
|
|
|
|
|
section.subsections.iter().map(|k| lib.get_section_path_by_key(*k)).collect(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
SerializingSection { |
|
|
SerializingSection { |
|
|
relative_path: §ion.file.relative, |
|
|
relative_path: §ion.file.relative, |
|
@@ -287,7 +285,7 @@ impl<'a> SerializingSection<'a> { |
|
|
assets: §ion.serialized_assets, |
|
|
assets: §ion.serialized_assets, |
|
|
lang: §ion.lang, |
|
|
lang: §ion.lang, |
|
|
pages: vec![], |
|
|
pages: vec![], |
|
|
subsections: vec![], |
|
|
|
|
|
|
|
|
subsections, |
|
|
translations, |
|
|
translations, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|