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/dl_list.rs | |
parent | a6b37fa5e1bd505adfae4888896be2a3aa49ec3a (diff) |
config entfernt, extra details parsen
Diffstat (limited to 'src/dl_list.rs')
-rw-r--r-- | src/dl_list.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/dl_list.rs b/src/dl_list.rs new file mode 100644 index 0000000..979c332 --- /dev/null +++ b/src/dl_list.rs | |||
@@ -0,0 +1,13 @@ | |||
1 | use super::regex::Regex; | ||
2 | |||
3 | #[derive(Debug)] | ||
4 | pub struct DLListItem { | ||
5 | name: String, | ||
6 | value: String, | ||
7 | } | ||
8 | |||
9 | pub fn parse(s: &str) -> Vec<DLListItem> { | ||
10 | let reg_list_item = Regex::new(r#"(?is)<dt.*?>(.*?)</dt>.*?<dd>(.*?)</dd>"#).unwrap(); | ||
11 | |||
12 | reg_list_item.captures_iter(s).map(|c| DLListItem { name: c.at(1).unwrap().into(), value: c.at(2).unwrap().into() }).collect() | ||
13 | } | ||