diff options
| -rw-r--r-- | Cargo.lock | 90 | ||||
| -rw-r--r-- | src/character.rs | 3 | ||||
| -rw-r--r-- | src/main.rs | 4 |
3 files changed, 93 insertions, 4 deletions
| @@ -3,6 +3,9 @@ name = "acd_character_parser" | |||
| 3 | version = "0.1.0" | 3 | version = "0.1.0" |
| 4 | dependencies = [ | 4 | dependencies = [ |
| 5 | "regex 0.1.77 (registry+https://github.com/rust-lang/crates.io-index)", | 5 | "regex 0.1.77 (registry+https://github.com/rust-lang/crates.io-index)", |
| 6 | "serde 0.8.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 7 | "serde_derive 0.8.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 8 | "serde_json 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 6 | "walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", | 9 | "walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", |
| 7 | "yaml-rust 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | 10 | "yaml-rust 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", |
| 8 | ] | 11 | ] |
| @@ -16,6 +19,16 @@ dependencies = [ | |||
| 16 | ] | 19 | ] |
| 17 | 20 | ||
| 18 | [[package]] | 21 | [[package]] |
| 22 | name = "dtoa" | ||
| 23 | version = "0.2.2" | ||
| 24 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 25 | |||
| 26 | [[package]] | ||
| 27 | name = "itoa" | ||
| 28 | version = "0.1.1" | ||
| 29 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 30 | |||
| 31 | [[package]] | ||
| 19 | name = "kernel32-sys" | 32 | name = "kernel32-sys" |
| 20 | version = "0.2.2" | 33 | version = "0.2.2" |
| 21 | source = "registry+https://github.com/rust-lang/crates.io-index" | 34 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -38,6 +51,16 @@ dependencies = [ | |||
| 38 | ] | 51 | ] |
| 39 | 52 | ||
| 40 | [[package]] | 53 | [[package]] |
| 54 | name = "num-traits" | ||
| 55 | version = "0.1.36" | ||
| 56 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 57 | |||
| 58 | [[package]] | ||
| 59 | name = "quote" | ||
| 60 | version = "0.2.0" | ||
| 61 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 62 | |||
| 63 | [[package]] | ||
| 41 | name = "regex" | 64 | name = "regex" |
| 42 | version = "0.1.77" | 65 | version = "0.1.77" |
| 43 | source = "registry+https://github.com/rust-lang/crates.io-index" | 66 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -55,6 +78,57 @@ version = "0.3.5" | |||
| 55 | source = "registry+https://github.com/rust-lang/crates.io-index" | 78 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 56 | 79 | ||
| 57 | [[package]] | 80 | [[package]] |
| 81 | name = "serde" | ||
| 82 | version = "0.8.10" | ||
| 83 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 84 | |||
| 85 | [[package]] | ||
| 86 | name = "serde_codegen" | ||
| 87 | version = "0.8.10" | ||
| 88 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 89 | dependencies = [ | ||
| 90 | "quote 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 91 | "serde_codegen_internals 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 92 | "syn 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 93 | ] | ||
| 94 | |||
| 95 | [[package]] | ||
| 96 | name = "serde_codegen_internals" | ||
| 97 | version = "0.9.0" | ||
| 98 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 99 | dependencies = [ | ||
| 100 | "syn 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 101 | ] | ||
| 102 | |||
| 103 | [[package]] | ||
| 104 | name = "serde_derive" | ||
| 105 | version = "0.8.10" | ||
| 106 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 107 | dependencies = [ | ||
| 108 | "serde_codegen 0.8.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 109 | ] | ||
| 110 | |||
| 111 | [[package]] | ||
| 112 | name = "serde_json" | ||
| 113 | version = "0.8.2" | ||
| 114 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 115 | dependencies = [ | ||
| 116 | "dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 117 | "itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 118 | "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 119 | "serde 0.8.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 120 | ] | ||
| 121 | |||
| 122 | [[package]] | ||
| 123 | name = "syn" | ||
| 124 | version = "0.8.2" | ||
| 125 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 126 | dependencies = [ | ||
| 127 | "quote 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 128 | "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||
| 129 | ] | ||
| 130 | |||
| 131 | [[package]] | ||
| 58 | name = "thread-id" | 132 | name = "thread-id" |
| 59 | version = "2.0.0" | 133 | version = "2.0.0" |
| 60 | source = "registry+https://github.com/rust-lang/crates.io-index" | 134 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -72,6 +146,11 @@ dependencies = [ | |||
| 72 | ] | 146 | ] |
| 73 | 147 | ||
| 74 | [[package]] | 148 | [[package]] |
| 149 | name = "unicode-xid" | ||
| 150 | version = "0.0.3" | ||
| 151 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 152 | |||
| 153 | [[package]] | ||
| 75 | name = "utf8-ranges" | 154 | name = "utf8-ranges" |
| 76 | version = "0.1.3" | 155 | version = "0.1.3" |
| 77 | source = "registry+https://github.com/rust-lang/crates.io-index" | 156 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -102,13 +181,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 102 | 181 | ||
| 103 | [metadata] | 182 | [metadata] |
| 104 | "checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" | 183 | "checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" |
| 184 | "checksum dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0dd841b58510c9618291ffa448da2e4e0f699d984d436122372f446dae62263d" | ||
| 185 | "checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1" | ||
| 105 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" | 186 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" |
| 106 | "checksum libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "408014cace30ee0f767b1c4517980646a573ec61a57957aeeabcac8ac0a02e8d" | 187 | "checksum libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "408014cace30ee0f767b1c4517980646a573ec61a57957aeeabcac8ac0a02e8d" |
| 107 | "checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" | 188 | "checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" |
| 189 | "checksum num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a16a42856a256b39c6d3484f097f6713e14feacd9bfb02290917904fae46c81c" | ||
| 190 | "checksum quote 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "502983ae4337dd7e30130ea1405d4bfc90424d8a38133baa68340b86f340dbfb" | ||
| 108 | "checksum regex 0.1.77 (registry+https://github.com/rust-lang/crates.io-index)" = "64b03446c466d35b42f2a8b203c8e03ed8b91c0f17b56e1f84f7210a257aa665" | 191 | "checksum regex 0.1.77 (registry+https://github.com/rust-lang/crates.io-index)" = "64b03446c466d35b42f2a8b203c8e03ed8b91c0f17b56e1f84f7210a257aa665" |
| 109 | "checksum regex-syntax 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279401017ae31cf4e15344aa3f085d0e2e5c1e70067289ef906906fdbe92c8fd" | 192 | "checksum regex-syntax 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279401017ae31cf4e15344aa3f085d0e2e5c1e70067289ef906906fdbe92c8fd" |
| 193 | "checksum serde 0.8.10 (registry+https://github.com/rust-lang/crates.io-index)" = "7a1687e7258b35aa6117cb52d65aa8f289d544fdad0c7a31822973b4465e4066" | ||
| 194 | "checksum serde_codegen 0.8.10 (registry+https://github.com/rust-lang/crates.io-index)" = "44d2c5df2af5b1e603d911d3c4f30febc2f0f25426ef9f468ba256c965f5afe8" | ||
| 195 | "checksum serde_codegen_internals 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b7fb3bda24f9eee7446793d209f7edac5400f85f002bff1c3d59ec678c728c9e" | ||
| 196 | "checksum serde_derive 0.8.10 (registry+https://github.com/rust-lang/crates.io-index)" = "658f0eea61a92a8574de65f05b84e210e08d5de5943fdc9a3d87ac17553803b9" | ||
| 197 | "checksum serde_json 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b3bb42fa42265df8a1822b3db2090bc8f9e17e8142599c76a5b854bc4e7b5b" | ||
| 198 | "checksum syn 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "666432ba8bf7a7bd46ec84b7c71739cc4836b5357aa3b76e0ea6da15f01f6220" | ||
| 110 | "checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" | 199 | "checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" |
| 111 | "checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" | 200 | "checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" |
| 201 | "checksum unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb" | ||
| 112 | "checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" | 202 | "checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" |
| 113 | "checksum walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c66c0b9792f0a765345452775f3adbd28dde9d33f30d13e5dcc5ae17cf6f3780" | 203 | "checksum walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c66c0b9792f0a765345452775f3adbd28dde9d33f30d13e5dcc5ae17cf6f3780" |
| 114 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" | 204 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" |
diff --git a/src/character.rs b/src/character.rs index c1d3829..489588e 100644 --- a/src/character.rs +++ b/src/character.rs | |||
| @@ -35,7 +35,6 @@ pub struct Character { | |||
| 35 | pub tags: Vec<Tag>, | 35 | pub tags: Vec<Tag>, |
| 36 | pub traits: Traits, | 36 | pub traits: Traits, |
| 37 | pub assignments: Vec<u32>, | 37 | pub assignments: Vec<u32>, |
| 38 | pub chars_similar_traits: Vec<u32>, | ||
| 39 | pub extra: Vec<DLListItem>, | 38 | pub extra: Vec<DLListItem>, |
| 40 | 39 | ||
| 41 | pub role: Option<String>, | 40 | pub role: Option<String>, |
| @@ -67,7 +66,6 @@ impl Character { | |||
| 67 | tags: vec![], | 66 | tags: vec![], |
| 68 | traits: Traits::new(), | 67 | traits: Traits::new(), |
| 69 | assignments: vec![], | 68 | assignments: vec![], |
| 70 | chars_similar_traits: vec![], | ||
| 71 | extra: vec![], | 69 | extra: vec![], |
| 72 | role: None | 70 | role: None |
| 73 | } | 71 | } |
| @@ -104,7 +102,6 @@ impl Character { | |||
| 104 | self.traits.indexed = dl_list::parse(&(§ions["traits"] as &Section).data["indexed_raw".into()]); | 102 | self.traits.indexed = dl_list::parse(&(§ions["traits"] as &Section).data["indexed_raw".into()]); |
| 105 | 103 | ||
| 106 | self.assignments = tiles::parse_tile_link_ids(&(§ions["assignments"] as &Section).data["raw".into()], "series"); | 104 | self.assignments = tiles::parse_tile_link_ids(&(§ions["assignments"] as &Section).data["raw".into()], "series"); |
| 107 | self.chars_similar_traits = tiles::parse_tile_link_ids(&(§ions["chars_similar_traits"] as &Section).data["raw".into()], "character"); | ||
| 108 | 105 | ||
| 109 | if misc.data["role".into()].len() > 0 { | 106 | if misc.data["role".into()].len() > 0 { |
| 110 | self.role = Some(misc.data["role".into()].clone()); | 107 | self.role = Some(misc.data["role".into()].clone()); |
diff --git a/src/main.rs b/src/main.rs index a7f1f9d..c91861a 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -45,7 +45,9 @@ fn main() { | |||
| 45 | 45 | ||
| 46 | let json = serde_json::to_string(&char).unwrap(); | 46 | let json = serde_json::to_string(&char).unwrap(); |
| 47 | 47 | ||
| 48 | let mut o = File::create(out_path.join(entry.file_name())).unwrap(); | 48 | let out_file = out_path.join(entry.file_name().to_str().unwrap().replace("html", "json")); |
| 49 | let mut o = File::create(&out_file).unwrap(); | ||
| 49 | o.write_all(json.as_bytes()).unwrap(); | 50 | o.write_all(json.as_bytes()).unwrap(); |
| 51 | println!("{:?}", out_file); | ||
| 50 | } | 52 | } |
| 51 | } | 53 | } |
