fix segments_from_str; version bump
This commit is contained in:
parent
e992e41635
commit
b9415ade9e
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "bitsy-parser"
|
||||
version = "0.72.3"
|
||||
version = "0.72.4"
|
||||
authors = ["Max Bradbury <max@tinybird.info>"]
|
||||
edition = "2018"
|
||||
description = "A parser and utilities for working with Bitsy game data"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{Dialogue, Ending, Font, Image, Item, Palette, Room, Sprite, TextDirection, Tile, Variable, transform_line_endings, segments_from_string, new_unique_id, try_id, Instance, Error};
|
||||
use crate::{Dialogue, Ending, Font, Image, Item, Palette, Room, Sprite, TextDirection, Tile, Variable, transform_line_endings, new_unique_id, try_id, Instance, Error};
|
||||
|
||||
use loe::TransformMode;
|
||||
|
||||
|
@ -125,7 +125,7 @@ impl Game {
|
|||
}
|
||||
|
||||
let string = string.trim_start_matches('\n').to_string();
|
||||
let mut segments = segments_from_str(&string);
|
||||
let mut segments = crate::segments_from_str(&string);
|
||||
|
||||
let mut name = "".to_string();
|
||||
|
||||
|
|
|
@ -108,11 +108,11 @@ fn transform_line_endings(input: String, mode: TransformMode) -> String {
|
|||
String::from_utf8(output.into_inner()).unwrap()
|
||||
}
|
||||
|
||||
fn segments_from_string(string: String) -> Vec<String> {
|
||||
fn segments_from_str(str: &str) -> 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 string = str.replace("\n\nNAME", "\n\"\"\"\n\"\"\"\nNAME");
|
||||
|
||||
let mut output:Vec<String> = Vec::new();
|
||||
// are we inside `"""\n...\n"""`? if so, ignore empty lines
|
||||
|
|
Loading…
Reference in New Issue