aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2017-01-05 00:24:36 -0800
committerbnewbold <bnewbold@robocracy.org>2017-01-05 00:24:36 -0800
commita7fb72e1a4a5f371326fe1efe8aeffb75bde243d (patch)
treee65373414df92bcd9c7263b01589e546abce0a37
parentaf3af9dd11f3573cf96c9b14b8566b345aad5e8e (diff)
downloadmodelthing-a7fb72e1a4a5f371326fe1efe8aeffb75bde243d.tar.gz
modelthing-a7fb72e1a4a5f371326fe1efe8aeffb75bde243d.zip
switch from 'markdown' to 'pulldown-cmark' for markdown rendering
-rw-r--r--Cargo.lock44
-rw-r--r--Cargo.toml2
-rw-r--r--src/bin/mt-webface.rs11
3 files changed, 26 insertions, 31 deletions
diff --git a/Cargo.lock b/Cargo.lock
index f631263..776a291 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8,9 +8,9 @@ dependencies = [
"error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "markdown 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"modelica-parser-lalrpop 0.1.0",
"pencil 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pulldown-cmark 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -81,6 +81,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "bitflags"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -143,14 +148,6 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "difference"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "docopt"
version = "0.6.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -437,16 +434,6 @@ version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "markdown"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "difference 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "pipeline 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "matches"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -614,11 +601,6 @@ dependencies = [
]
[[package]]
-name = "pipeline"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
name = "pkg-config"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -632,6 +614,15 @@ dependencies = [
]
[[package]]
+name = "pulldown-cmark"
+version = "0.0.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "quick-error"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -889,6 +880,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum bit-set 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "84527c7b0452f22545cc010e72d366a435561d2b28b978035550b3778c4d428d"
"checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d"
"checksum bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dead7461c1127cf637931a1e50934eb6eee8bff2f74433ac7909e9afcee04a3"
+"checksum bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f67931368edf3a9a51d29886d245f1c3db2f1ef0dcc9e35ff70341b78c10d23"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum buf-read-ext 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc384072fac32fb50f4a327c33e2004897d11c561d008dd6031fb7f19b04de2c"
"checksum cfg-if 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de1e760d7b6535af4241fca8bd8adf68e2e7edacc6b29f5d399050c5e48cf88c"
@@ -897,7 +889,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0e3d6405328b6edb412158b3b7710e2634e23f3614b9bb1c412df7952489a626"
"checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850"
"checksum diff 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e48977eec6d3b7707462c2dc2e1363ad91b5dd822cf942537ccdc2085dc87587"
-"checksum difference 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ffef4c144e881a906ed5bd6e1e749dc1955cd3f0c7969d3d34122a971981c5ea"
"checksum docopt 0.6.86 (registry+https://github.com/rust-lang/crates.io-index)" = "4a7ef30445607f6fc8720f0a0a2c7442284b629cf0d049286860fae23e71c4d9"
"checksum encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
"checksum encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91"
@@ -931,7 +922,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "044d1360593a78f5c8e5e710beccdc24ab71d1f01bc19a29bcacdba22e8475d8"
"checksum libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "cbc058951ab6a3ef35ca16462d7642c4867e6403520811f28537a4e2f2db3e71"
"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054"
-"checksum markdown 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fd5d33ad7582d518092d7a5703eede03cb0c5ad3b7617eb62b4770061a2bed"
"checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1"
"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20"
"checksum mime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5c93a4bd787ddc6e7833c519b73a50883deb5863d76d9b71eb8216fb7f94e66"
@@ -948,9 +938,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum phf_codegen 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "6b63f121bf9a128f2172a65d8313a8e0e79d63874eeb4b4b7d82e6dda6b62f7c"
"checksum phf_generator 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "50ffbd7970f75afa083c5dd7b6830c97b72b81579c7a92d8134ef2ee6c0c7eb0"
"checksum phf_shared 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "286385a0e50d4147bce15b2c19f0cf84c395b0e061aaf840898a7bf664c2cfb7"
-"checksum pipeline 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d15b6607fa632996eb8a17c9041cb6071cb75ac057abd45dece578723ea8c7c0"
"checksum pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8cee804ecc7eaf201a4a207241472cc870e825206f6c031e3ee2a72fa425f2fa"
"checksum pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "61c9231d31aea845007443d62fcbb58bb6949ab9c18081ee1e09920e0cf1118b"
+"checksum pulldown-cmark 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1058d7bb927ca067656537eec4e02c2b4b70eaaa129664c5b90c111e20326f41"
"checksum quick-error 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0aad603e8d7fb67da22dbdf1f4b826ce8829e406124109e73cf1b2454b93a71c"
"checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d"
"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f"
diff --git a/Cargo.toml b/Cargo.toml
index 663c8b4..2522069 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,7 +9,7 @@ clap = "2"
toml = "0.2"
log = "0.3"
env_logger = "0.3"
-markdown = "0.1"
+pulldown-cmark = "^0.0.8"
error-chain = "0.7"
modelica-parser-lalrpop = { version = "*", path = "./modelica-parser-lalrpop" }
diff --git a/src/bin/mt-webface.rs b/src/bin/mt-webface.rs
index ccf4660..3d17bb5 100644
--- a/src/bin/mt-webface.rs
+++ b/src/bin/mt-webface.rs
@@ -3,7 +3,7 @@ extern crate getopts;
extern crate pencil;
extern crate modelthing;
extern crate env_logger;
-extern crate markdown;
+extern crate pulldown_cmark;
#[macro_use]
extern crate log;
@@ -55,13 +55,18 @@ fn model_view(r: &mut Request) -> PencilResult {
let model_path = Path::new(namespace).join(model_slug);
match modelthing::load_model_entry(model_path.as_path()) {
Ok(me) => {
+ let mut markdown_html = String::new();
+ let p = pulldown_cmark::Parser::new_ext(
+ &me.markdown,
+ pulldown_cmark::Options::empty());
+ pulldown_cmark::html::push_html(&mut markdown_html, p);
let mut context = BTreeMap::new();
context.insert("namespace".to_string(), namespace.to_string());
context.insert("model_slug".to_string(), model_slug.to_string());
context.insert("model_name".to_string(), me.ast.name.clone());
context.insert("model_description".to_string(), me.ast.description.clone().unwrap_or("".to_string()));
- context.insert("markdown_html".to_string(), markdown::to_html(&me.markdown));
- context.insert("markdown".to_string(), me.markdown);
+ context.insert("markdown_html".to_string(), markdown_html);
+ context.insert("markdown".to_string(), me.markdown.clone());
context.insert("modelica".to_string(), format!("{:?}", me.ast));
r.app.render_template("model_view.html", &context)
},