-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fixes missing the default "theme" dir location #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bb92507
to
3bb7fb1
Compare
I think this is better fixed directly by giving the |
Yep that's much better idea :) I have pushed a version with suggested changes which in addition changes HtmlConfig.theme from -------------------------- src/config/htmlconfig.rs ---------------------------
index 1c42a34..c90c76b 100644
@@ -25,9 +25,10 @@ impl HtmlConfig {
/// assert_eq!(config.get_destination(), &output);
/// ```
pub fn new<T: Into<PathBuf>>(root: T) -> Self {
+ let root = root.into();
HtmlConfig {
- destination: root.into().join("book"),
- theme: None,
+ destination: root.clone().join("book"),
+ theme: Some(root.join("theme")),
curly_quotes: false,
google_analytics: None,
additional_css: Vec::new(), edit: Pushed the correct branch now. |
if not specified in book.toml
@@ -46,7 +46,7 @@ pub struct Theme { | |||
} | |||
|
|||
impl Theme { | |||
pub fn new(src: Option<&PathBuf>) -> Self { | |||
pub fn new(src: Option<&Path>) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we can remove the option here too, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about it but but there is this problem that while in the context of HtmlConfig
the theme
is guaranteed, it is not in the context of MdBook
as the HtmlConfig
is optional itself
pub fn get_theme_path(&self) -> Option<&Path> {
if let Some(htmlconfig) = self.config.get_html_config() {
return Some(htmlconfig.get_theme());
}
None
}
So removing this option will make us jump through hoops here:
--> src/renderer/html_handlebars/hbs_renderer.rs:36:39
|
36 | let theme = theme::Theme::new(book.get_theme_path());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, let's keep it like it is for now then. Maybe it will get refactored with all the planned changes anyway.
Fixes missing the default "theme" dir location
if one is not specified in book.toml
fixes https://github.com/azerupi/mdBook/issues/313