diff options
| author | jan <jan@ruken.pw> | 2016-09-26 10:22:38 (UTC) |
|---|---|---|
| committer | jan <jan@ruken.pw> | 2016-09-26 10:22:38 (UTC) |
| commit | 23942b01ada4ef30a4bf183d90650ade56255ecc (patch) | |
| tree | f223ff9e594665b5974e9ccf587baff3d407eeb8 /src/pre_process.rs | |
| parent | 75ac0507ce8142ab4105e4067debf79b63ac7e62 (diff) | |
sektions-parsing, character bilder werden derzeit ausgegeben
Diffstat (limited to 'src/pre_process.rs')
| -rw-r--r-- | src/pre_process.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/pre_process.rs b/src/pre_process.rs index aa55bd8..d69cfce 100644 --- a/src/pre_process.rs +++ b/src/pre_process.rs | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | use super::regex::Regex; | ||
| 2 | |||
| 1 | pub fn strip_irrelevant_content(s: &str) -> String { | 3 | pub fn strip_irrelevant_content(s: &str) -> String { |
| 2 | let mut retn = ""; | 4 | let mut retn = ""; |
| 3 | match s.find(r#"<div class=profile id=profile>"#) { | 5 | match s.find(r#"<div class=profile id=profile>"#) { |
| @@ -10,4 +12,19 @@ pub fn strip_irrelevant_content(s: &str) -> String { | |||
| 10 | None => (), | 12 | None => (), |
| 11 | }; | 13 | }; |
| 12 | return retn.into(); | 14 | return retn.into(); |
| 15 | } | ||
| 16 | |||
| 17 | pub struct Section { | ||
| 18 | pub name: String, | ||
| 19 | pub re: Regex, | ||
| 20 | pub content: String, | ||
| 21 | } | ||
| 22 | |||
| 23 | pub fn split_sections(d: &str, s: &mut Vec<Section>) { | ||
| 24 | for section in s { | ||
| 25 | for m in section.re.captures_iter(d) { | ||
| 26 | assert!(m.len() > 1); | ||
| 27 | section.content = format!("{}", m.at(1).unwrap()); | ||
| 28 | } | ||
| 29 | } | ||
| 13 | } \ No newline at end of file | 30 | } \ No newline at end of file |
