Zipped scenes and sections for html generation
This commit is contained in:
parent
da84e0fe69
commit
e141e29d7e
@ -40,15 +40,13 @@ fn generate_html(scenes: Vec<Markup>, sections: Vec<Markup>) -> Markup {
|
||||
html! {
|
||||
div #story-container {
|
||||
div .scene-viewport {
|
||||
@for (index, scene) in scenes.iter().enumerate() {
|
||||
@for (index, (scene, section)) in (scenes.iter().zip(sections)).enumerate() {
|
||||
article .scene-section
|
||||
data-section-index=(index)
|
||||
style=(format!("display: {};", if index == 0 { "block" } else { "none" })) {
|
||||
(scene)
|
||||
}
|
||||
}
|
||||
|
||||
@for (index, section) in sections.into_iter().enumerate() {
|
||||
section .text-section
|
||||
data-section-index=(index)
|
||||
style=(format!("display: {};", if index == 0 { "block" } else { "none" })) {
|
||||
@ -319,7 +317,7 @@ pub fn render_novel(
|
||||
let named_multilinear_info = named_multilinear_info.as_ref();
|
||||
|
||||
let dialogs = parse_map(pk_path, &mut settings_context)?;
|
||||
let (mut scenes, sections) =
|
||||
let (mut scenes, mut sections) =
|
||||
process_dialog(&dialogs[choice], &mut player_settings, start_level);
|
||||
|
||||
if let Some(_named_multilinear_info) = named_multilinear_info {
|
||||
@ -345,6 +343,7 @@ pub fn render_novel(
|
||||
};
|
||||
|
||||
scenes.push(choices_html);
|
||||
sections.push(html!());
|
||||
}
|
||||
|
||||
let html = generate_html(scenes, sections);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user