Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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