handle empty dialogue line (poorly...)
This commit is contained in:
parent
ef310d6fb7
commit
c06dc237a6
|
@ -247,7 +247,8 @@ impl ToString for Game {
|
|||
}
|
||||
|
||||
for dialogue in &self.dialogues {
|
||||
segments.push(dialogue.to_string());
|
||||
// this replacement is silly but see segments_from_string() for explanation
|
||||
segments.push(dialogue.to_string().replace("\"\"\"\n\"\"\"", ""));
|
||||
}
|
||||
|
||||
for ending in &self.endings {
|
||||
|
|
|
@ -115,6 +115,11 @@ fn transform_line_endings(input: String, mode: TransformMode) -> String {
|
|||
|
||||
#[inline]
|
||||
fn segments_from_string(string: String) -> Vec<String> {
|
||||
// this is pretty weird but a dialogue can just have an empty line followed by a name
|
||||
// however, on entering two empty lines, dialogue will be wrapped in triple quotation marks
|
||||
// so, handle this here
|
||||
let string = string.replace("\n\nNAME", "\n\"\"\"\n\"\"\"\nNAME");
|
||||
|
||||
let mut output:Vec<String> = Vec::new();
|
||||
// are we inside `"""\n...\n"""`? if so, ignore empty lines
|
||||
let mut inside_escaped_block = false;
|
||||
|
|
Loading…
Reference in New Issue