mirror of
https://github.com/orhun/systeroid
synced 2024-07-21 18:35:03 +00:00
refactor(docs): simplify the documentation matching logic
This commit is contained in:
parent
3fb8a07f84
commit
9f7092ac17
|
@ -143,20 +143,16 @@ impl Sysctl {
|
|||
.iter()
|
||||
.filter(|document| Section::from(document.path.as_path()) == param.section)
|
||||
{
|
||||
if let Some(paragraph) = document
|
||||
.paragraphs
|
||||
.par_iter()
|
||||
.find_first(|paragraph| param.get_absolute_name() == Some(¶graph.title))
|
||||
.or_else(|| {
|
||||
document.paragraphs.par_iter().find_first(|paragraph| {
|
||||
match param.get_absolute_name() {
|
||||
Some(absolute_name) => {
|
||||
absolute_name.len() > 2
|
||||
if let Some(paragraph) =
|
||||
document.paragraphs.par_iter().find_first(|paragraph| {
|
||||
match param.get_absolute_name() {
|
||||
Some(absolute_name) => {
|
||||
absolute_name == ¶graph.title
|
||||
|| absolute_name.len() > 2
|
||||
&& paragraph.title.contains(absolute_name)
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
})
|
||||
None => false,
|
||||
}
|
||||
})
|
||||
{
|
||||
param.description = Some(paragraph.contents.to_owned());
|
||||
|
|
Loading…
Reference in a new issue