diff options
author | jan <jan@ruken.pw> | 2016-10-01 10:45:55 (UTC) |
---|---|---|
committer | jan <jan@ruken.pw> | 2016-10-01 10:45:55 (UTC) |
commit | ad63b49b94bf4b4596e6420e37d265a57b77d731 (patch) | |
tree | 73234b1a5f4d34e6b1771e4309374fd05bebd881 /src/character.rs | |
parent | a6b37fa5e1bd505adfae4888896be2a3aa49ec3a (diff) |
config entfernt, extra details parsen
Diffstat (limited to 'src/character.rs')
-rw-r--r-- | src/character.rs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/character.rs b/src/character.rs index 98c4850..b82ac18 100644 --- a/src/character.rs +++ b/src/character.rs | |||
@@ -1,5 +1,8 @@ | |||
1 | use super::tags::Tag; | 1 | use super::tags::Tag; |
2 | use super::traits::Trait; | 2 | use super::dl_list::DLListItem; |
3 | use super::section::Section; | ||
4 | |||
5 | use std::collections::HashMap; | ||
3 | 6 | ||
4 | #[derive(Debug)] | 7 | #[derive(Debug)] |
5 | pub struct Names { | 8 | pub struct Names { |
@@ -16,8 +19,8 @@ pub struct Images { | |||
16 | 19 | ||
17 | #[derive(Debug)] | 20 | #[derive(Debug)] |
18 | pub struct Traits { | 21 | pub struct Traits { |
19 | pub official: Vec<Trait>, | 22 | pub official: Vec<DLListItem>, |
20 | pub indexed: Vec<Trait>, | 23 | pub indexed: Vec<DLListItem>, |
21 | } | 24 | } |
22 | 25 | ||
23 | #[derive(Debug)] | 26 | #[derive(Debug)] |
@@ -26,6 +29,18 @@ pub struct Character { | |||
26 | pub image: Images, | 29 | pub image: Images, |
27 | pub tags: Vec<Tag>, | 30 | pub tags: Vec<Tag>, |
28 | pub traits: Traits, | 31 | pub traits: Traits, |
32 | pub extra: Vec<DLListItem>, | ||
29 | 33 | ||
30 | pub role: Option<String> | 34 | pub role: Option<String> |
31 | } | 35 | } |
36 | |||
37 | pub fn get_sections() -> HashMap<String, Section> { | ||
38 | let mut s: HashMap<String, Section> = HashMap::new(); | ||
39 | |||
40 | s.insert("name".into(), Section::new("name", r#"(?is)Romaji Name.*?<TD>(.*?)\s?</TD>.*?Japanese Name.*?<TD>(.*?)\s?</TD>.*?Aliases.*?<TD>(.*?)\s?</TD>"#, vec!["romaji", "japanese", "aliases"])); | ||
41 | s.insert("misc".into(), Section::new("misc", r#"(?is)Role</TH>.*?<TD>(.*?)\s?</TD>"#, vec!["role"])); | ||
42 | s.insert("image".into(), Section::new("image", r#"(?is)<H3 id="section99">.*<img src="(.*?)" alt=.*?></a><p><a href="(.*?)">View Full Size Image"#, vec!["thumb", "full"])); | ||
43 | s.insert("tags".into(), Section::new("tags", r#"(?is)tagged as</P>.*?<TH>(.*?)</TH>"#, vec!["tags_raw"])); | ||
44 | s.insert("traits".into(), Section::new("traits", r#"(?is)indexed traits</P>.*?<dl>(.*?)</dl>.*?official traits\s?</P>.*?<dl>(.*?)</dl>"#, vec!["indexed_raw", "official_raw"])); | ||
45 | s | ||
46 | } | ||