use super::tags;
use super::tags::Tag;
use super::dl_list;
use super::dl_list::DLListItem;
use super::section;
use super::section::Section;
use super::regex::Regex;
use super::tiles;
use std::collections::HashMap;
#[derive(Debug)]
pub struct Names {
pub romaji: String,
pub japanese: String,
pub aliases: Vec(.*?)
"#).unwrap();
let mut sections = get_sections();
section::process(&buf, &mut sections);
let caps = re_extras.captures(&buf);
if caps.is_some() {
self.extra = dl_list::parse(caps.unwrap().at(1).unwrap());
}
{
let name: &Section = §ions["name".into()];
let image: &Section = §ions["image".into()];
let misc: &Section = §ions["misc".into()];
self.name.romaji = name.data["romaji".into()].clone();
self.name.japanese = name.data["japanese".into()].clone();
if name.data["aliases".into()].len() > 0 {
self.name.aliases = name.data["aliases".into()].split(", ").map(|s| s.to_string()).collect();
}
self.image.thumb = image.data["thumb".into()].clone();
self.image.full = image.data["full".into()].clone();
self.tags = tags::parse(&(§ions["tags".into()] as &Section).data["tags_raw".into()]);
self.traits.official = dl_list::parse(&(§ions["traits"] as &Section).data["official_raw".into()]);
self.traits.indexed = dl_list::parse(&(§ions["traits"] as &Section).data["indexed_raw".into()]);
self.assignments = tiles::parse_tile_link_ids(&(§ions["assignments"] as &Section).data["raw".into()], "series");
self.chars_similar_traits = tiles::parse_tile_link_ids(&(§ions["chars_similar_traits"] as &Section).data["raw".into()], "character");
if misc.data["role".into()].len() > 0 {
self.role = Some(misc.data["role".into()].clone());
}
}
}
}
fn get_sections() -> HashMap(.*?)\s? .*?Japanese Name.*?(.*?)\s? .*?Aliases.*?(.*?)\s? "#, vec!["romaji", "japanese", "aliases"]));
s.insert("misc".into(), Section::new("misc", r#"(?is)Role.*?(.*?)\s? "#, vec!["role"]));
s.insert("image".into(), Section::new("image", r#"(?is).*
.*?(.*?) "#, vec!["tags_raw"]));
s.insert("traits".into(), Section::new("traits", r#"(?is)indexed traits