Merge pull request #163 from RadicalZephyr/remove-dependency-cycle
Extract syntex highlighting module into a new component in workspace
This commit is contained in:
commit
ab5a3c58db
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -238,7 +238,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"errors 0.1.0",
|
"errors 0.1.0",
|
||||||
"rendering 0.1.0",
|
"highlighting 0.1.0",
|
||||||
"serde 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_derive 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -440,6 +440,14 @@ dependencies = [
|
||||||
"ws 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ws 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "highlighting"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syntect 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "httparse"
|
name = "httparse"
|
||||||
version = "1.2.3"
|
version = "1.2.3"
|
||||||
|
@ -939,6 +947,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"errors 0.1.0",
|
"errors 0.1.0",
|
||||||
"front_matter 0.1.0",
|
"front_matter 0.1.0",
|
||||||
|
"highlighting 0.1.0",
|
||||||
"lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -42,6 +42,7 @@ members = [
|
||||||
"components/content",
|
"components/content",
|
||||||
"components/errors",
|
"components/errors",
|
||||||
"components/front_matter",
|
"components/front_matter",
|
||||||
|
"components/highlighting",
|
||||||
"components/pagination",
|
"components/pagination",
|
||||||
"components/rendering",
|
"components/rendering",
|
||||||
"components/site",
|
"components/site",
|
||||||
|
|
|
@ -10,4 +10,4 @@ serde_derive = "1.0"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
|
|
||||||
errors = { path = "../errors" }
|
errors = { path = "../errors" }
|
||||||
rendering = { path = "../rendering" }
|
highlighting = { path = "../highlighting"}
|
||||||
|
|
|
@ -3,7 +3,7 @@ extern crate serde_derive;
|
||||||
extern crate toml;
|
extern crate toml;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate errors;
|
extern crate errors;
|
||||||
extern crate rendering;
|
extern crate highlighting;
|
||||||
extern crate chrono;
|
extern crate chrono;
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
@ -15,7 +15,7 @@ use toml::{Value as Toml};
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
|
|
||||||
use errors::{Result, ResultExt};
|
use errors::{Result, ResultExt};
|
||||||
use rendering::highlighting::THEME_SET;
|
use highlighting::THEME_SET;
|
||||||
|
|
||||||
|
|
||||||
mod theme;
|
mod theme;
|
||||||
|
|
3
components/errors/src/lib.rs
Normal file → Executable file
3
components/errors/src/lib.rs
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
||||||
|
#![allow(unused_doc_comment)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate error_chain;
|
extern crate error_chain;
|
||||||
extern crate tera;
|
extern crate tera;
|
||||||
|
@ -26,4 +28,3 @@ macro_rules! bail {
|
||||||
return Err(format!($fmt, $($arg)+).into());
|
return Err(format!($fmt, $($arg)+).into());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
components/highlighting/Cargo.toml
Normal file
8
components/highlighting/Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "highlighting"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Vincent Prouillet <vincent@wearewizards.io>"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
lazy_static = "0.2"
|
||||||
|
syntect = { version = "1", features = ["static-onig"] }
|
19
components/highlighting/src/lib.rs
Normal file
19
components/highlighting/src/lib.rs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#[macro_use]
|
||||||
|
extern crate lazy_static;
|
||||||
|
extern crate syntect;
|
||||||
|
|
||||||
|
use syntect::dumps::from_binary;
|
||||||
|
use syntect::parsing::SyntaxSet;
|
||||||
|
use syntect::highlighting::ThemeSet;
|
||||||
|
|
||||||
|
thread_local!{
|
||||||
|
pub static SYNTAX_SET: SyntaxSet = {
|
||||||
|
let mut ss: SyntaxSet = from_binary(include_bytes!("../../../sublime_syntaxes/newlines.packdump"));
|
||||||
|
ss.link_syntaxes();
|
||||||
|
ss
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
lazy_static!{
|
||||||
|
pub static ref THEME_SET: ThemeSet = from_binary(include_bytes!("../../../sublime_themes/all.themedump"));
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ serde_derive = "1.0"
|
||||||
|
|
||||||
errors = { path = "../errors" }
|
errors = { path = "../errors" }
|
||||||
front_matter = { path = "../front_matter" }
|
front_matter = { path = "../front_matter" }
|
||||||
|
highlighting = { path = "../highlighting"}
|
||||||
utils = { path = "../utils" }
|
utils = { path = "../utils" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -11,13 +11,13 @@ extern crate serde;
|
||||||
|
|
||||||
extern crate errors;
|
extern crate errors;
|
||||||
extern crate front_matter;
|
extern crate front_matter;
|
||||||
|
extern crate highlighting;
|
||||||
extern crate utils;
|
extern crate utils;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern crate templates;
|
extern crate templates;
|
||||||
|
|
||||||
mod context;
|
mod context;
|
||||||
pub mod highlighting;
|
|
||||||
mod markdown;
|
mod markdown;
|
||||||
mod short_code;
|
mod short_code;
|
||||||
mod table_of_contents;
|
mod table_of_contents;
|
||||||
|
|
Loading…
Reference in a new issue