Skip to content

Commit 595ad98

Browse files
author
Robin
authored
Merge pull request #1 from roeegh/master
removed print feature and windows build from action
2 parents 6549932 + 0ed4c25 commit 595ad98

File tree

13 files changed

+104
-233
lines changed

13 files changed

+104
-233
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ${{ matrix.os }}
1010
strategy:
1111
matrix:
12-
os: [ubuntu-latest, macos-latest, windows-latest]
12+
os: [ubuntu-latest, macos-latest]
1313
steps:
1414
- uses: actions/checkout@master
1515
- name: Install hub

.github/workflows/main.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,14 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
build: [stable, beta, nightly, macos, windows, msrv]
15+
build: [stable, macos]
1616
include:
1717
- build: stable
1818
os: ubuntu-latest
1919
rust: stable
20-
- build: beta
21-
os: ubuntu-latest
22-
rust: beta
23-
- build: nightly
24-
os: ubuntu-latest
25-
rust: nightly
2620
- build: macos
2721
os: macos-latest
2822
rust: stable
29-
- build: windows
30-
os: windows-latest
31-
rust: stable
32-
- build: msrv
33-
os: ubuntu-latest
34-
# sync MSRV with docs: guide/src/guide/installation.md
35-
rust: 1.54.0
3623
steps:
3724
- uses: actions/checkout@master
3825
- name: Install Rust

guide/src/format/theme/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Here are the files you can override:
1717
- **_css/_** contains the CSS files for styling the book.
1818
- **_css/chrome.css_** is for UI elements.
1919
- **_css/general.css_** is the base styles.
20-
- **_css/print.css_** is the style for printer output.
20+
<!-- - **_css/print.css_** is the style for printer output. -->
2121
- **_css/variables.css_** contains variables used in other CSS files.
2222
- **_book.js_** is mostly used to add client side functionality, like hiding /
2323
un-hiding the sidebar, changing the theme, ...

src/book/init.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ impl BookBuilder {
134134
let mut chrome_css = File::create(cssdir.join("chrome.css"))?;
135135
chrome_css.write_all(theme::CHROME_CSS)?;
136136

137-
if html_config.print.enable {
138-
let mut print_css = File::create(cssdir.join("print.css"))?;
139-
print_css.write_all(theme::PRINT_CSS)?;
140-
}
137+
// if html_config.print.enable {
138+
// let mut print_css = File::create(cssdir.join("print.css"))?;
139+
// print_css.write_all(theme::PRINT_CSS)?;
140+
// }
141141

142142
let mut variables_css = File::create(cssdir.join("variables.css"))?;
143143
variables_css.write_all(theme::VARIABLES_CSS)?;

src/config.rs

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ pub struct HtmlConfig {
501501
#[serde(alias = "playpen")]
502502
pub playground: Playground,
503503
/// Print settings.
504-
pub print: Print,
504+
// pub print: Print,
505505
/// Don't render section labels.
506506
pub no_section_label: bool,
507507
/// Search settings. If `None`, the default will be used.
@@ -553,7 +553,7 @@ impl Default for HtmlConfig {
553553
additional_js: Vec::new(),
554554
fold: Fold::default(),
555555
playground: Playground::default(),
556-
print: Print::default(),
556+
// print: Print::default(),
557557
no_section_label: false,
558558
search: None,
559559
git_repository_url: None,
@@ -580,23 +580,23 @@ impl HtmlConfig {
580580
}
581581

582582
/// Configuration for how to render the print icon, print.html, and print.css.
583-
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
584-
#[serde(default, rename_all = "kebab-case")]
585-
pub struct Print {
586-
/// Whether print support is enabled.
587-
pub enable: bool,
588-
/// Insert page breaks between chapters. Default: `true`.
589-
pub page_break: bool,
590-
}
591-
592-
impl Default for Print {
593-
fn default() -> Self {
594-
Self {
595-
enable: true,
596-
page_break: true,
597-
}
598-
}
599-
}
583+
// #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
584+
// #[serde(default, rename_all = "kebab-case")]
585+
// pub struct Print {
586+
// /// Whether print support is enabled.
587+
// pub enable: bool,
588+
// /// Insert page breaks between chapters. Default: `true`.
589+
// pub page_break: bool,
590+
// }
591+
592+
// impl Default for Print {
593+
// fn default() -> Self {
594+
// Self {
595+
// enable: true,
596+
// page_break: true,
597+
// }
598+
// }
599+
// }
600600

601601
/// Configuration for how to fold chapters of sidebar.
602602
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
@@ -1168,23 +1168,23 @@ mod tests {
11681168
Config::from_str(src).unwrap();
11691169
}
11701170

1171-
#[test]
1172-
fn print_config() {
1173-
let src = r#"
1174-
[output.html.print]
1175-
enable = false
1176-
"#;
1177-
let got = Config::from_str(src).unwrap();
1178-
let html_config = got.html_config().unwrap();
1179-
assert!(!html_config.print.enable);
1180-
assert!(html_config.print.page_break);
1181-
let src = r#"
1182-
[output.html.print]
1183-
page-break = false
1184-
"#;
1185-
let got = Config::from_str(src).unwrap();
1186-
let html_config = got.html_config().unwrap();
1187-
assert!(html_config.print.enable);
1188-
assert!(!html_config.print.page_break);
1189-
}
1171+
// #[test]
1172+
// fn print_config() {
1173+
// let src = r#"
1174+
// [output.html.print]
1175+
// enable = false
1176+
// "#;
1177+
// let got = Config::from_str(src).unwrap();
1178+
// let html_config = got.html_config().unwrap();
1179+
// assert!(!html_config.print.enable);
1180+
// assert!(html_config.print.page_break);
1181+
// let src = r#"
1182+
// [output.html.print]
1183+
// page-break = false
1184+
// "#;
1185+
// let got = Config::from_str(src).unwrap();
1186+
// let html_config = got.html_config().unwrap();
1187+
// assert!(html_config.print.enable);
1188+
// assert!(!html_config.print.page_break);
1189+
// }
11901190
}

src/renderer/html_handlebars/hbs_renderer.rs

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ impl HtmlHandlebars {
5656

5757
let fixed_content =
5858
utils::render_markdown_with_path(&ch.content, ctx.html_config.curly_quotes, Some(path));
59-
if !ctx.is_index && ctx.html_config.print.page_break {
60-
// Add page break between chapters
61-
// See https://developer.mozilla.org/en-US/docs/Web/CSS/break-before and https://developer.mozilla.org/en-US/docs/Web/CSS/page-break-before
62-
// Add both two CSS properties because of the compatibility issue
63-
print_content
64-
.push_str(r#"<div style="break-before: page; page-break-before: always;"></div>"#);
65-
}
59+
// if !ctx.is_index && ctx.html_config.print.page_break {
60+
// // Add page break between chapters
61+
// // See https://developer.mozilla.org/en-US/docs/Web/CSS/break-before and https://developer.mozilla.org/en-US/docs/Web/CSS/page-break-before
62+
// // Add both two CSS properties because of the compatibility issue
63+
// print_content
64+
// .push_str(r#"<div style="break-before: page; page-break-before: always;"></div>"#);
65+
// }
6666
print_content.push_str(&fixed_content);
6767

6868
// Update the context with data for this file
@@ -72,9 +72,9 @@ impl HtmlHandlebars {
7272
let filepath = Path::new(&ctx_path).with_extension("html");
7373

7474
// "print.html" is used for the print page.
75-
if path == Path::new("print.md") {
76-
bail!("{} is reserved for internal use", path.display());
77-
};
75+
// if path == Path::new("print.md") {
76+
// bail!("{} is reserved for internal use", path.display());
77+
// };
7878

7979
let book_title = ctx
8080
.data
@@ -222,9 +222,9 @@ impl HtmlHandlebars {
222222
write_file(destination, "book.js", &theme.js)?;
223223
write_file(destination, "css/general.css", &theme.general_css)?;
224224
write_file(destination, "css/chrome.css", &theme.chrome_css)?;
225-
if html_config.print.enable {
226-
write_file(destination, "css/print.css", &theme.print_css)?;
227-
}
225+
// if html_config.print.enable {
226+
// write_file(destination, "css/print.css", &theme.print_css)?;
227+
// }
228228
write_file(destination, "css/variables.css", &theme.variables_css)?;
229229
if let Some(contents) = &theme.favicon_png {
230230
write_file(destination, "favicon.png", contents)?;
@@ -311,22 +311,22 @@ impl HtmlHandlebars {
311311
}
312312

313313
/// Update the context with data for this file
314-
fn configure_print_version(
315-
&self,
316-
data: &mut serde_json::Map<String, serde_json::Value>,
317-
print_content: &str,
318-
) {
319-
// Make sure that the Print chapter does not display the title from
320-
// the last rendered chapter by removing it from its context
321-
data.remove("title");
322-
data.insert("is_print".to_owned(), json!(true));
323-
data.insert("path".to_owned(), json!("print.md"));
324-
data.insert("content".to_owned(), json!(print_content));
325-
data.insert(
326-
"path_to_root".to_owned(),
327-
json!(utils::fs::path_to_root(Path::new("print.md"))),
328-
);
329-
}
314+
// fn configure_print_version(
315+
// &self,
316+
// data: &mut serde_json::Map<String, serde_json::Value>,
317+
// print_content: &str,
318+
// ) {
319+
// // Make sure that the Print chapter does not display the title from
320+
// // the last rendered chapter by removing it from its context
321+
// data.remove("title");
322+
// data.insert("is_print".to_owned(), json!(true));
323+
// data.insert("path".to_owned(), json!("print.md"));
324+
// data.insert("content".to_owned(), json!(print_content));
325+
// data.insert(
326+
// "path_to_root".to_owned(),
327+
// json!(utils::fs::path_to_root(Path::new("print.md"))),
328+
// );
329+
// }
330330

331331
fn register_hbs_helpers(&self, handlebars: &mut Handlebars<'_>, html_config: &HtmlConfig) {
332332
handlebars.register_helper(
@@ -550,22 +550,22 @@ impl Renderer for HtmlHandlebars {
550550
}
551551

552552
// Print version
553-
self.configure_print_version(&mut data, &print_content);
554-
if let Some(ref title) = ctx.config.book.title {
555-
data.insert("title".to_owned(), json!(title));
556-
}
553+
// self.configure_print_version(&mut data, &print_content);
554+
// if let Some(ref title) = ctx.config.book.title {
555+
// data.insert("title".to_owned(), json!(title));
556+
// }
557557

558558
// Render the handlebars template with the data
559-
if html_config.print.enable {
560-
debug!("Render template");
561-
let rendered = handlebars.render("index", &data)?;
559+
// if html_config.print.enable {
560+
// debug!("Render template");
561+
// let rendered = handlebars.render("index", &data)?;
562562

563-
let rendered =
564-
self.post_process(rendered, &html_config.playground, ctx.config.rust.edition);
563+
// let rendered =
564+
// self.post_process(rendered, &html_config.playground, ctx.config.rust.edition);
565565

566-
utils::fs::write_file(destination, "print.html", rendered.as_bytes())?;
567-
debug!("Creating print.html ✓");
568-
}
566+
// utils::fs::write_file(destination, "print.html", rendered.as_bytes())?;
567+
// debug!("Creating print.html ✓");
568+
// }
569569

570570
debug!("Copy static files");
571571
self.copy_static_files(destination, &theme, &html_config)
@@ -689,7 +689,7 @@ fn make_data(
689689
data.insert("playground_copyable".to_owned(), json!(true));
690690
}
691691

692-
data.insert("print_enable".to_owned(), json!(html_config.print.enable));
692+
// data.insert("print_enable".to_owned(), json!(html_config.print.enable));
693693
data.insert("fold_enable".to_owned(), json!(html_config.fold.enable));
694694
data.insert("fold_level".to_owned(), json!(html_config.fold.level));
695695

src/theme/book.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -464,14 +464,6 @@ function playground_text(playground) {
464464
});
465465
})();
466466

467-
(function scrollToTop () {
468-
var menuTitle = document.querySelector('.menu-title');
469-
470-
menuTitle.addEventListener('click', function () {
471-
document.scrollingElement.scrollTo({ top: 0, behavior: 'smooth' });
472-
});
473-
})();
474-
475467
(function controllMenu() {
476468
var menu = document.getElementById('menu-bar');
477469

src/theme/css/print.css

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)