Section info not optional anymore
This commit is contained in:
parent
ce23dcf455
commit
81134d2007
15
src/main.rs
15
src/main.rs
@ -651,10 +651,9 @@ fn handle_relative_connection(
|
||||
Comment(Vec<Comment>),
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct Section {
|
||||
title: Box<str>,
|
||||
info: Option<SectionInfo>,
|
||||
info: SectionInfo,
|
||||
}
|
||||
|
||||
let mut sections = Vec::new();
|
||||
@ -671,7 +670,7 @@ fn handle_relative_connection(
|
||||
if let Some(config_map) = config_map {
|
||||
sections.push(Section {
|
||||
title: "Game".into(),
|
||||
info: Some(SectionInfo::Game(config_map)),
|
||||
info: SectionInfo::Game(config_map),
|
||||
});
|
||||
} else {
|
||||
let Ok(pk_file) = File::open(file_paths.pk) else {
|
||||
@ -689,7 +688,7 @@ fn handle_relative_connection(
|
||||
if !current_title.is_empty() {
|
||||
sections.push(Section {
|
||||
title: current_title,
|
||||
info: Some(SectionInfo::Lines(current_lines)),
|
||||
info: SectionInfo::Lines(current_lines),
|
||||
})
|
||||
}
|
||||
current_title = title.into();
|
||||
@ -703,20 +702,20 @@ fn handle_relative_connection(
|
||||
|
||||
sections.push(Section {
|
||||
title: current_title,
|
||||
info: Some(SectionInfo::Lines(current_lines)),
|
||||
info: SectionInfo::Lines(current_lines),
|
||||
})
|
||||
}
|
||||
|
||||
if file_paths.pki.is_some() {
|
||||
sections.push(Section {
|
||||
title: "Description".into(),
|
||||
info: Some(SectionInfo::Description),
|
||||
info: SectionInfo::Description,
|
||||
});
|
||||
}
|
||||
|
||||
sections.push(Section {
|
||||
title: "Comments".into(),
|
||||
info: Some(SectionInfo::Comment(comments)),
|
||||
info: SectionInfo::Comment(comments),
|
||||
});
|
||||
|
||||
let count = sections.len();
|
||||
@ -802,7 +801,6 @@ fn handle_relative_connection(
|
||||
for (i, Section { info, .. }) in sections.into_iter().enumerate() {
|
||||
let index = i + 1;
|
||||
let _ = write!(stream, r#"<div class="tab-content" id="content-{index}">"#);
|
||||
if let Some(info) = info {
|
||||
match info {
|
||||
SectionInfo::Lines(lines) => {
|
||||
convert_extended(
|
||||
@ -878,7 +876,6 @@ fn handle_relative_connection(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let _ = write!(stream, "</div>");
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user