From 0306854192ba35861d2365a00f080e1f7710e03b Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sat, 14 Jan 2017 19:41:27 -0800 Subject: add latex (via katex) to model pages --- src/bin/mt-webface.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/bin') diff --git a/src/bin/mt-webface.rs b/src/bin/mt-webface.rs index 5361a73..ed0cacb 100644 --- a/src/bin/mt-webface.rs +++ b/src/bin/mt-webface.rs @@ -21,6 +21,7 @@ use pencil::method::{Get, Post}; use regex::Regex; use modelthing::transpile_scheme::TranspileScheme; use modelthing::transpile_js::TranspileJS; +use modelthing::transpile_latex::TranspileLaTeX; /* This command doesn't use error_chain (or raise errors in general) because the @@ -84,6 +85,7 @@ fn model_view(r: &mut Request) -> PencilResult { context.insert("markdown_html".to_string(), markdown_html); context.insert("markdown".to_string(), me.markdown.clone()); context.insert("modelica".to_string(), format!("{:?}", me.ast)); + context.insert("latex".to_string(), me.ast.repr_latex().unwrap()); context.insert("editable".to_string(), if namespace == "sandbox" { "true".to_string() } else { "".to_string() }); r.app.render_template("model_view.html", &context) @@ -108,6 +110,7 @@ fn model_repr(r: &mut Request) -> PencilResult { match format { "scheme" => Ok(Response::from(me.ast.repr_scheme().unwrap())), "javascript" => Ok(Response::from(me.ast.repr_js().unwrap())), + "latex" => Ok(Response::from(me.ast.repr_latex().unwrap())), _ => abort(403), } }, -- cgit v1.2.3