pub use serde_json;
use serde_json::{Value, Map};
#[derive(Debug, Clone)]
pub struct Story {
pub title: String,
pub passages: Vec<Passage>,
pub meta: Map<String, Value>,
}
#[derive(Debug, Clone)]
pub struct Passage {
pub name: String,
pub tags: Vec<String>,
pub meta: Map<String, Value>,
pub content: String,
}
#[derive(Error, Debug)]
pub enum Error {
#[error("Could not parse HTML: {0}")]
#[cfg(feature = "html")]
HTMLParseError(ParseError),
#[error("No tw-storydata tag found in HTML")]
#[cfg(feature = "html")]
HTMLStoryDataNotFound,
}
#[derive(Debug, Clone)]
pub enum Warning {
StoryMetadataMalformed,
StoryTitleMissing,
PassageMetadataMalformed(String),
PassageTagsMalformed(String),
PassageDuplicated(String),
PassageNameMissing,
}
mod twee3;
use thiserror::Error;
pub use twee3::*;
#[cfg(feature = "html")]
mod html;
#[cfg(feature = "html")]
pub use html::*;
#[cfg(feature = "html")]
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn parse_twee() {
let story = parse_twee3(include_str!("../test-data/Test Story.twee")).unwrap();
assert!(story.1.len() == 0, "{:?}", story.1);
}
}