Updated choice rendering
This commit is contained in:
parent
58eca41435
commit
987d2c67be
13
src/vn.rs
13
src/vn.rs
@ -1,5 +1,6 @@
|
||||
use std::{collections::HashMap, fs::File, io::prelude::*, net::TcpStream, path::Path};
|
||||
|
||||
use dialogi::DialogBlock;
|
||||
use indexmap::IndexMap;
|
||||
use maud::{Markup, html};
|
||||
use multilinear_parser::{NamedMultilinearInfo, parse_multilinear};
|
||||
@ -311,13 +312,8 @@ fn load_multilinear(mld_path: &Path) -> Option<NamedMultilinearInfo> {
|
||||
parse_multilinear(file).ok()
|
||||
}
|
||||
|
||||
fn render_choice(
|
||||
dialog_sequence: &dialogi::DialogSequence<Change, Parameter>,
|
||||
index: usize,
|
||||
progress: &str,
|
||||
) -> Markup {
|
||||
fn render_choice(block: &DialogBlock<Parameter>, index: usize, progress: &str) -> Markup {
|
||||
html! {
|
||||
@if let Some(block) = dialog_sequence.blocks.first() {
|
||||
form method="POST" {
|
||||
input type="hidden" name="progress" value=(progress);
|
||||
input type="hidden" name="choice" value=(index);
|
||||
@ -333,7 +329,6 @@ fn render_choice(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render_novel(
|
||||
mut config_map: IndexMap<Box<str>, Box<str>>,
|
||||
@ -360,7 +355,9 @@ pub fn render_novel(
|
||||
let choices_html = html! {
|
||||
div .choices-section {
|
||||
@for (i, dialog_sequence) in dialogs.iter().enumerate() {
|
||||
(render_choice(dialog_sequence, i, progress))
|
||||
@if let Some(block) = dialog_sequence.blocks.first() {
|
||||
(render_choice(block, i, progress))
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user