Skip to content

Commit 9fcff53

Browse files
committed
define output-thingy
it compiles, so what does it mean?
1 parent 7aa75b6 commit 9fcff53

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ use std::io::BufRead;
77
mod mdslurp;
88
use mdslurp::MarkdownEle;
99

10+
mod mdout;
11+
use mdout::MarkdownOut;
12+
13+
1014
fn main() {
1115
let mut args = env::args();
1216
let prog = args.next().expect("no $0 ?");
@@ -30,6 +34,7 @@ fn do_split(input: BufReader<File>, outdir: &Path, split_depth: u32) {
3034

3135
let lines = input.lines().filter_map(|result| result.ok());
3236
let mut lines = lines.peekable();
37+
let mut output = MarkdownOut::new(outdir, "prelude");
3338
loop {
3439
let line = match lines.next() {
3540
None => break,

src/mdout.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
use std::path::{Path, PathBuf};
2+
use std::fs::File;
3+
4+
// #[derive(Debug)] // XXX: not for File
5+
pub struct MarkdownOut<'a> {
6+
outdir: &'a Path,
7+
filenum: u32,
8+
outpath: PathBuf,
9+
outfh: File,
10+
}
11+
12+
impl<'a> MarkdownOut<'a> {
13+
pub fn new(outdir: &'a Path, leafname: &str) -> MarkdownOut<'a> {
14+
let mut outpath = outdir.to_path_buf();
15+
outpath.push(leafname);
16+
let f = File::create(outpath.as_path()).unwrap();
17+
let new = MarkdownOut { outdir: outdir, filenum: 0, outpath: outpath, outfh: f };
18+
new
19+
}
20+
}
21+

0 commit comments

Comments
 (0)