From 23942b01ada4ef30a4bf183d90650ade56255ecc Mon Sep 17 00:00:00 2001 From: jan Date: Mon, 26 Sep 2016 12:22:38 +0200 Subject: sektions-parsing, character bilder werden derzeit ausgegeben diff --git a/src/main.rs b/src/main.rs index 066a07a..b733e6f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,11 +10,19 @@ use std::env; use std::path::{Path, PathBuf}; mod pre_process; +use pre_process::Section; fn main() { let raw_files = env::var("RAW_FILES").unwrap_or("S:\\grilist\\acd\\acd_character_parser\\characters\\".into()); let base_path = Path::new(&raw_files); + let mut sections: Vec
= vec![]; + sections.push(Section { + name: "image".into(), + re: Regex::new(r#"(?is)

.*

View Full Size Image"#).unwrap(), + content: String::new(), + }); + for entry in WalkDir::new(base_path).min_depth(1).into_iter().filter_map(|e| e.ok()) { let mut f = File::open(entry.path()).expect("could not open file"); let mut buf = String::new(); @@ -24,5 +32,9 @@ fn main() { } let buf = pre_process::strip_irrelevant_content(&buf); + + pre_process::split_sections(&buf, &mut sections); + + println!("{}", sections[0].content); } } 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 @@ +use super::regex::Regex; + pub fn strip_irrelevant_content(s: &str) -> String { let mut retn = ""; match s.find(r#"