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