aboutsummaryrefslogtreecommitdiff
path: root/src/pre_process.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/pre_process.rs')
-rw-r--r--src/pre_process.rs17
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 @@
1use super::regex::Regex;
2
1pub fn strip_irrelevant_content(s: &str) -> String { 3pub 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
17pub struct Section {
18 pub name: String,
19 pub re: Regex,
20 pub content: String,
21}
22
23pub 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