add Book theme (Liberation fonts need to be in /fonts/ on the server)
This commit is contained in:
parent
c068703028
commit
9b6f5a9840
|
@ -134,6 +134,9 @@ impl BookBuilder {
|
||||||
let mut general_css = File::create(cssdir.join("general.css"))?;
|
let mut general_css = File::create(cssdir.join("general.css"))?;
|
||||||
general_css.write_all(theme::GENERAL_CSS)?;
|
general_css.write_all(theme::GENERAL_CSS)?;
|
||||||
|
|
||||||
|
let mut book_css = File::create(cssdir.join("book.css"))?;
|
||||||
|
book_css.write_all(theme::BOOK_CSS)?;
|
||||||
|
|
||||||
let mut chrome_css = File::create(cssdir.join("chrome.css"))?;
|
let mut chrome_css = File::create(cssdir.join("chrome.css"))?;
|
||||||
chrome_css.write_all(theme::CHROME_CSS)?;
|
chrome_css.write_all(theme::CHROME_CSS)?;
|
||||||
|
|
||||||
|
|
|
@ -119,6 +119,7 @@ impl HtmlHandlebars {
|
||||||
|
|
||||||
write_file(destination, "book.js", &theme.js)?;
|
write_file(destination, "book.js", &theme.js)?;
|
||||||
write_file(destination, "css/general.css", &theme.general_css)?;
|
write_file(destination, "css/general.css", &theme.general_css)?;
|
||||||
|
write_file(destination, "css/book.css", &theme.book_css)?;
|
||||||
write_file(destination, "css/chrome.css", &theme.chrome_css)?;
|
write_file(destination, "css/chrome.css", &theme.chrome_css)?;
|
||||||
write_file(destination, "css/print.css", &theme.print_css)?;
|
write_file(destination, "css/print.css", &theme.print_css)?;
|
||||||
write_file(destination, "css/variables.css", &theme.variables_css)?;
|
write_file(destination, "css/variables.css", &theme.variables_css)?;
|
||||||
|
@ -558,7 +559,7 @@ fn fix_code_blocks(html: &str) -> String {
|
||||||
let after = &caps[3];
|
let after = &caps[3];
|
||||||
|
|
||||||
format!(
|
format!(
|
||||||
r#"<code{before}class="{classes}"{after}>"#,
|
r#"<code{before}class="block {classes}"{after}>"#,
|
||||||
before = before,
|
before = before,
|
||||||
classes = classes,
|
classes = classes,
|
||||||
after = after
|
after = after
|
||||||
|
|
|
@ -331,6 +331,12 @@ function playpen_text(playpen) {
|
||||||
stylesheets.tomorrowNight.disabled = true;
|
stylesheets.tomorrowNight.disabled = true;
|
||||||
stylesheets.highlight.disabled = true;
|
stylesheets.highlight.disabled = true;
|
||||||
|
|
||||||
|
ace_theme = "ace/theme/tomorrow_night";
|
||||||
|
} else if (theme == 'classic') {
|
||||||
|
stylesheets.ayuHighlight.disabled = true;
|
||||||
|
stylesheets.tomorrowNight.disabled = true;
|
||||||
|
stylesheets.highlight.disabled = true;
|
||||||
|
|
||||||
ace_theme = "ace/theme/tomorrow_night";
|
ace_theme = "ace/theme/tomorrow_night";
|
||||||
} else {
|
} else {
|
||||||
stylesheets.ayuHighlight.disabled = true;
|
stylesheets.ayuHighlight.disabled = true;
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
@font-face {
|
||||||
|
font-family: "Liberation Serif";
|
||||||
|
src: url("/fonts/LiberationSerif-Regular.ttf");
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
@font-face {
|
||||||
|
font-family: "Liberation Serif";
|
||||||
|
src: url("/fonts/LiberationSerif-Bold.ttf");
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
@font-face {
|
||||||
|
font-family: "Liberation Serif";
|
||||||
|
src: url("/fonts/LiberationSerif-Italic.ttf");
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
@font-face {
|
||||||
|
font-family: "Liberation Mono";
|
||||||
|
src: url("/fonts/LiberationMono-Regular.ttf");
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: "Liberation Serif", serif;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
text-align: justify;
|
||||||
|
line-height: 1.25em;
|
||||||
|
}
|
||||||
|
code {
|
||||||
|
font-family: "Liberation Mono", monospace;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
margin-left: 2em;
|
||||||
|
}
|
||||||
|
pre pre {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
pre.playpen > div.buttons {
|
||||||
|
float: right;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
em {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
h3::before {
|
||||||
|
content: "¶";
|
||||||
|
width: 1em;
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: -1em;
|
||||||
|
}
|
||||||
|
h4::before {
|
||||||
|
content: "§";
|
||||||
|
width: 1em;
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: -1em;
|
||||||
|
}
|
||||||
|
#menu-bar-sticky-container {
|
||||||
|
background-color: rgba(255, 255, 255, 0.8) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
.bottons {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
font-size: 11pt;
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,6 +13,7 @@
|
||||||
<link rel="stylesheet" href="{{ path_to_root }}css/variables.css">
|
<link rel="stylesheet" href="{{ path_to_root }}css/variables.css">
|
||||||
<link rel="stylesheet" href="{{ path_to_root }}css/general.css">
|
<link rel="stylesheet" href="{{ path_to_root }}css/general.css">
|
||||||
<link rel="stylesheet" href="{{ path_to_root }}css/chrome.css">
|
<link rel="stylesheet" href="{{ path_to_root }}css/chrome.css">
|
||||||
|
<link rel="stylesheet" href="{{ path_to_root }}css/book.css">
|
||||||
<link rel="stylesheet" href="{{ path_to_root }}css/print.css" media="print">
|
<link rel="stylesheet" href="{{ path_to_root }}css/print.css" media="print">
|
||||||
|
|
||||||
<!-- Fonts -->
|
<!-- Fonts -->
|
||||||
|
@ -24,7 +25,6 @@
|
||||||
<link rel="stylesheet" href="{{ path_to_root }}highlight.css">
|
<link rel="stylesheet" href="{{ path_to_root }}highlight.css">
|
||||||
<link rel="stylesheet" href="{{ path_to_root }}tomorrow-night.css">
|
<link rel="stylesheet" href="{{ path_to_root }}tomorrow-night.css">
|
||||||
<link rel="stylesheet" href="{{ path_to_root }}ayu-highlight.css">
|
<link rel="stylesheet" href="{{ path_to_root }}ayu-highlight.css">
|
||||||
|
|
||||||
<!-- Custom theme stylesheets -->
|
<!-- Custom theme stylesheets -->
|
||||||
{{#each additional_css}}
|
{{#each additional_css}}
|
||||||
<link rel="stylesheet" href="{{ ../path_to_root }}{{ this }}">
|
<link rel="stylesheet" href="{{ ../path_to_root }}{{ this }}">
|
||||||
|
@ -102,6 +102,7 @@
|
||||||
<li role="none"><button role="menuitem" class="theme" id="coal">{{ theme_option "Coal" }}</button></li>
|
<li role="none"><button role="menuitem" class="theme" id="coal">{{ theme_option "Coal" }}</button></li>
|
||||||
<li role="none"><button role="menuitem" class="theme" id="navy">{{ theme_option "Navy" }}</button></li>
|
<li role="none"><button role="menuitem" class="theme" id="navy">{{ theme_option "Navy" }}</button></li>
|
||||||
<li role="none"><button role="menuitem" class="theme" id="ayu">{{ theme_option "Ayu" }}</button></li>
|
<li role="none"><button role="menuitem" class="theme" id="ayu">{{ theme_option "Ayu" }}</button></li>
|
||||||
|
<li role="none"><button role="menuitem" class="theme" id="book">{{ theme_option "Book" }}</button></li>
|
||||||
</ul>
|
</ul>
|
||||||
{{#if search_enabled}}
|
{{#if search_enabled}}
|
||||||
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
|
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
|
||||||
|
|
|
@ -15,6 +15,7 @@ pub static INDEX: &'static [u8] = include_bytes!("index.hbs");
|
||||||
pub static HEADER: &'static [u8] = include_bytes!("header.hbs");
|
pub static HEADER: &'static [u8] = include_bytes!("header.hbs");
|
||||||
pub static CHROME_CSS: &'static [u8] = include_bytes!("css/chrome.css");
|
pub static CHROME_CSS: &'static [u8] = include_bytes!("css/chrome.css");
|
||||||
pub static GENERAL_CSS: &'static [u8] = include_bytes!("css/general.css");
|
pub static GENERAL_CSS: &'static [u8] = include_bytes!("css/general.css");
|
||||||
|
pub static BOOK_CSS: &'static [u8] = include_bytes!("css/book.css");
|
||||||
pub static PRINT_CSS: &'static [u8] = include_bytes!("css/print.css");
|
pub static PRINT_CSS: &'static [u8] = include_bytes!("css/print.css");
|
||||||
pub static VARIABLES_CSS: &'static [u8] = include_bytes!("css/variables.css");
|
pub static VARIABLES_CSS: &'static [u8] = include_bytes!("css/variables.css");
|
||||||
pub static FAVICON: &'static [u8] = include_bytes!("favicon.png");
|
pub static FAVICON: &'static [u8] = include_bytes!("favicon.png");
|
||||||
|
@ -49,6 +50,7 @@ pub struct Theme {
|
||||||
pub header: Vec<u8>,
|
pub header: Vec<u8>,
|
||||||
pub chrome_css: Vec<u8>,
|
pub chrome_css: Vec<u8>,
|
||||||
pub general_css: Vec<u8>,
|
pub general_css: Vec<u8>,
|
||||||
|
pub book_css: Vec<u8>,
|
||||||
pub print_css: Vec<u8>,
|
pub print_css: Vec<u8>,
|
||||||
pub variables_css: Vec<u8>,
|
pub variables_css: Vec<u8>,
|
||||||
pub favicon: Vec<u8>,
|
pub favicon: Vec<u8>,
|
||||||
|
@ -80,6 +82,7 @@ impl Theme {
|
||||||
(theme_dir.join("book.js"), &mut theme.js),
|
(theme_dir.join("book.js"), &mut theme.js),
|
||||||
(theme_dir.join("css/chrome.css"), &mut theme.chrome_css),
|
(theme_dir.join("css/chrome.css"), &mut theme.chrome_css),
|
||||||
(theme_dir.join("css/general.css"), &mut theme.general_css),
|
(theme_dir.join("css/general.css"), &mut theme.general_css),
|
||||||
|
(theme_dir.join("css/book.css"), &mut theme.book_css),
|
||||||
(theme_dir.join("css/print.css"), &mut theme.print_css),
|
(theme_dir.join("css/print.css"), &mut theme.print_css),
|
||||||
(
|
(
|
||||||
theme_dir.join("css/variables.css"),
|
theme_dir.join("css/variables.css"),
|
||||||
|
@ -121,6 +124,7 @@ impl Default for Theme {
|
||||||
header: HEADER.to_owned(),
|
header: HEADER.to_owned(),
|
||||||
chrome_css: CHROME_CSS.to_owned(),
|
chrome_css: CHROME_CSS.to_owned(),
|
||||||
general_css: GENERAL_CSS.to_owned(),
|
general_css: GENERAL_CSS.to_owned(),
|
||||||
|
book_css: BOOK_CSS.to_owned(),
|
||||||
print_css: PRINT_CSS.to_owned(),
|
print_css: PRINT_CSS.to_owned(),
|
||||||
variables_css: VARIABLES_CSS.to_owned(),
|
variables_css: VARIABLES_CSS.to_owned(),
|
||||||
favicon: FAVICON.to_owned(),
|
favicon: FAVICON.to_owned(),
|
||||||
|
@ -176,6 +180,7 @@ mod tests {
|
||||||
"favicon.png",
|
"favicon.png",
|
||||||
"css/chrome.css",
|
"css/chrome.css",
|
||||||
"css/general.css",
|
"css/general.css",
|
||||||
|
"css/book.css",
|
||||||
"css/print.css",
|
"css/print.css",
|
||||||
"css/variables.css",
|
"css/variables.css",
|
||||||
"book.js",
|
"book.js",
|
||||||
|
@ -208,6 +213,7 @@ mod tests {
|
||||||
highlight_css: Vec::new(),
|
highlight_css: Vec::new(),
|
||||||
tomorrow_night_css: Vec::new(),
|
tomorrow_night_css: Vec::new(),
|
||||||
ayu_highlight_css: Vec::new(),
|
ayu_highlight_css: Vec::new(),
|
||||||
|
book_css: Vec::new(),
|
||||||
highlight_js: Vec::new(),
|
highlight_js: Vec::new(),
|
||||||
clipboard_js: Vec::new(),
|
clipboard_js: Vec::new(),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue