aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-10-30 21:48:52 -0700
committerbnewbold <bnewbold@robocracy.org>2016-10-30 21:48:55 -0700
commit8f5696e6b8d77a106c920bc52efda3af09a23228 (patch)
tree6756f1b4b427254a768d60c8213a7ec44575ee17
parent440c700657b70ae54a958c20f3a19c417712ceab (diff)
downloadmodelthing-8f5696e6b8d77a106c920bc52efda3af09a23228.tar.gz
modelthing-8f5696e6b8d77a106c920bc52efda3af09a23228.zip
render markdown
IMPORTANT: simply un-escaping here, which isn't safe
-rw-r--r--Cargo.lock27
-rw-r--r--Cargo.toml1
-rw-r--r--src/bin/mt-webface.rs2
-rw-r--r--webface/templates/model_view.html2
4 files changed, 31 insertions, 1 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 37aa199..e693250 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -8,6 +8,7 @@ dependencies = [
"lalrpop 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lalrpop-util 0.12.0 (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)",
"pencil 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -76,6 +77,14 @@ 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.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -354,6 +363,16 @@ 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.77 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "matches"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -511,6 +530,11 @@ 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"
@@ -752,6 +776,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum buf-read-ext 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc384072fac32fb50f4a327c33e2004897d11c561d008dd6031fb7f19b04de2c"
"checksum cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0e3d6405328b6edb412158b3b7710e2634e23f3614b9bb1c412df7952489a626"
"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.83 (registry+https://github.com/rust-lang/crates.io-index)" = "fc42c6077823a361410c37d47c2535b73a190cbe10838dc4f400fe87c10c8c3b"
"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"
@@ -784,6 +809,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "408014cace30ee0f767b1c4517980646a573ec61a57957aeeabcac8ac0a02e8d"
"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.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc3ad8109fa4b522f9b0cd81440422781f564aaf8c195de6b9d6642177ad0dd"
"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"
@@ -800,6 +826,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum phf_codegen 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)" = "563b670811792d49bff142e7bb9787530d9b689fb4c55c6c309822d8d956a242"
"checksum phf_generator 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)" = "21416830a6c83526443b960fd41b5e18f64c4e4f90970499aeed2be592029042"
"checksum phf_shared 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)" = "4a65f09191172833c798d31e5317ecd1e4be890a3d5acc6c2f85e1460c8828bd"
+"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 quick-error 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0aad603e8d7fb67da22dbdf1f4b826ce8829e406124109e73cf1b2454b93a71c"
diff --git a/Cargo.toml b/Cargo.toml
index dc8a299..cbb3394 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,7 @@ toml = "0.2"
log = "0.3"
env_logger = "0.3"
lalrpop-util = "0.12"
+markdown = "0.1"
# parser util
rustc-serialize = "0.3"
diff --git a/src/bin/mt-webface.rs b/src/bin/mt-webface.rs
index a11a038..b5b4fe0 100644
--- a/src/bin/mt-webface.rs
+++ b/src/bin/mt-webface.rs
@@ -3,6 +3,7 @@ extern crate getopts;
extern crate pencil;
extern crate modelthing;
extern crate env_logger;
+extern crate markdown;
#[macro_use]
extern crate log;
@@ -46,6 +47,7 @@ fn model_view(r: &mut Request) -> PencilResult {
context.insert("model_name".to_string(), me.metadata.name_en);
context.insert("model_description".to_string(), me.metadata.description_en.unwrap_or("".to_string()));
//context.insert("metadata".to_string(), me.metadata);
+ context.insert("markdown_html".to_string(), markdown::to_html(&me.markdown));
context.insert("markdown".to_string(), me.markdown);
context.insert("modelica".to_string(), format!("{:?}", me.ast));
r.app.render_template("model_view.html", &context)
diff --git a/webface/templates/model_view.html b/webface/templates/model_view.html
index 4add92b..11ffab7 100644
--- a/webface/templates/model_view.html
+++ b/webface/templates/model_view.html
@@ -13,7 +13,7 @@
</pre>
<h2>Wiki Page</h2>
-{{ markdown }}
+{{{ markdown_html }}}
{{/partial}}
{{~> base.html~}}