Skip to content

Commit

Permalink
Merge pull request #9 from zemlanin/master
Browse files Browse the repository at this point in the history
io reform update
  • Loading branch information
Johann Hofmann committed Feb 15, 2015
2 parents 7529732 + b979d03 commit 2453ffa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ exclude = [
]

[dependencies]
regex_macros = "0.1.5"
regex = "0.1.10"
regex_macros = "0.1.8"
regex = "0.1.14"
15 changes: 9 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#![crate_name = "markdown"]

#![feature(fs)]
#![feature(io)]
#![feature(plugin)]
#[plugin] #[no_link]
#![plugin(regex_macros)]
extern crate regex_macros;
extern crate regex;

use std::io::File;
use std::io::IoError;
use std::fs::File;
use std::io::{Read, Error};

mod parser;
mod html;
Expand All @@ -18,14 +20,15 @@ pub fn to_html(text : &str) -> String{
html::to_html(&result)
}

pub fn file_to_html(path : &Path) -> Result<String, IoError>{
pub fn file_to_html(path : &Path) -> Result<String, Error>{
let mut file = match File::open(path) {
Ok(file) => file,
Err(e) => return Err(e)
};

let text = match file.read_to_string() {
Ok(string) => string,
let mut text = String::new();
match file.read_to_string(&mut text) {
Ok(()) => (),
Err(e) => return Err(e)
};

Expand Down
4 changes: 2 additions & 2 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod block;

static SPLIT : Regex = regex!(r"\n(?:\s*\n|$)");

#[derive(Show, PartialEq)]
#[derive(Debug, PartialEq)]
pub enum Block {
Header(Vec<Span>, usize),
Paragraph(Vec<Span>),
Expand All @@ -15,7 +15,7 @@ pub enum Block {
Hr
}

#[derive(Show, PartialEq)]
#[derive(Debug, PartialEq)]
pub enum Span {
Break,
Text(String),
Expand Down

0 comments on commit 2453ffa

Please sign in to comment.