MathJax: Path to root
If `source` starts with `/` interpret it relative to output dir.
This commit is contained in:
parent
48808bfb75
commit
4c20ab4248
|
@ -681,10 +681,15 @@ fn make_data(
|
|||
data.insert("mathjax_support".to_owned(), json!(true));
|
||||
} else if html_config.mathjax.enable {
|
||||
data.insert("mathjax_enable".to_owned(), json!(true));
|
||||
data.insert(
|
||||
"mathjax_source".to_owned(),
|
||||
json!(html_config.mathjax.source),
|
||||
);
|
||||
if let Some(ref source) = html_config.mathjax.source {
|
||||
if source.starts_with("/") {
|
||||
data.insert("mathjax_root".to_owned(), json!(true));
|
||||
let (_, relative_source) = source.split_at(1);
|
||||
data.insert("mathjax_source".to_owned(), json!(relative_source));
|
||||
} else {
|
||||
data.insert("mathjax_source".to_owned(), json!(source));
|
||||
}
|
||||
}
|
||||
data.insert(
|
||||
"mathjax_config".to_owned(),
|
||||
json!(html_config.mathjax.config),
|
||||
|
|
|
@ -67,9 +67,13 @@
|
|||
};
|
||||
</script>
|
||||
{{/if}}
|
||||
{{#if mathjax_root}}
|
||||
<script id="MathJax-script" async src="{{ path_to_root }}{{ mathjax_source }}/{{ mathjax_config }}.js"></script>
|
||||
{{else}}
|
||||
<script id="MathJax-script" async src="{{ mathjax_source }}/{{ mathjax_config }}.js"></script>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</head>
|
||||
<body>
|
||||
<div id="body-container">
|
||||
|
|
Loading…
Reference in New Issue