Skip to content

Commit 330085b

Browse files
committed
Merge branch 'master' of https://github.com/titaneric/mdBook
2 parents 5e9f4a1 + 3faa6c1 commit 330085b

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/book/init.rs

+6
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,13 @@ impl BookBuilder {
156156

157157
let mut highlight_js = File::create(themedir.join("highlight.js"))?;
158158
highlight_js.write_all(theme::HIGHLIGHT_JS)?;
159+
160+
let mut iframe = File::create(themedir.join("iframe.html"))?;
161+
iframe.write_all(theme::IFRAME)?;
159162

163+
let mut wasm_entry_js = File::create(themedir.join("wasm-entry.mjs"))?;
164+
wasm_entry_js.write_all(theme::WASM_ENTRY_MJS)?;
165+
160166
Ok(())
161167
}
162168

src/renderer/html_handlebars/hbs_renderer.rs

+2
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ impl HtmlHandlebars {
200200
write_file(destination, "CNAME", format!("{}\n", cname).as_bytes())?;
201201
}
202202

203+
write_file(destination, "iframe.html", &theme.iframe_html)?;
204+
write_file(destination, "wasm-entry.mjs", &theme.wasm_entry_mjs)?;
203205
write_file(destination, "book.js", &theme.js)?;
204206
write_file(destination, "css/general.css", &theme.general_css)?;
205207
write_file(destination, "css/chrome.css", &theme.chrome_css)?;

src/theme/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ use std::path::Path;
1313

1414
use crate::errors::*;
1515

16+
pub static IFRAME: &[u8] = include_bytes!("iframe.html");
17+
pub static WASM_ENTRY_MJS: &[u8] = include_bytes!("wasm-entry.mjs");
1618
pub static INDEX: &[u8] = include_bytes!("index.hbs");
1719
pub static HEAD: &[u8] = include_bytes!("head.hbs");
1820
pub static REDIRECT: &[u8] = include_bytes!("redirect.hbs");
@@ -62,6 +64,8 @@ pub struct Theme {
6264
pub ayu_highlight_css: Vec<u8>,
6365
pub highlight_js: Vec<u8>,
6466
pub clipboard_js: Vec<u8>,
67+
pub iframe_html: Vec<u8>,
68+
pub wasm_entry_mjs: Vec<u8>,
6569
}
6670

6771
impl Theme {
@@ -79,6 +83,8 @@ impl Theme {
7983
// Check for individual files, if they exist copy them across
8084
{
8185
let files = vec![
86+
(theme_dir.join("iframe.html"), &mut theme.iframe_html),
87+
(theme_dir.join("wasm-entry.mjs"), &mut theme.wasm_entry_mjs),
8288
(theme_dir.join("index.hbs"), &mut theme.index),
8389
(theme_dir.join("head.hbs"), &mut theme.head),
8490
(theme_dir.join("redirect.hbs"), &mut theme.redirect),
@@ -161,6 +167,8 @@ impl Default for Theme {
161167
ayu_highlight_css: AYU_HIGHLIGHT_CSS.to_owned(),
162168
highlight_js: HIGHLIGHT_JS.to_owned(),
163169
clipboard_js: CLIPBOARD_JS.to_owned(),
170+
iframe_html: IFRAME.to_owned(),
171+
wasm_entry_mjs: WASM_ENTRY_MJS.to_owned(),
164172
}
165173
}
166174
}
@@ -248,6 +256,8 @@ mod tests {
248256
ayu_highlight_css: Vec::new(),
249257
highlight_js: Vec::new(),
250258
clipboard_js: Vec::new(),
259+
iframe_html: Vec::new(),
260+
wasm_entry_mjs: Vec::new(),
251261
};
252262

253263
assert_eq!(got, empty);

0 commit comments

Comments
 (0)