fix: minor fixes

- restore default debug level when logging to file
- return early from generating epubs if there are no articles
- fix serialization bug in creating attributes
This commit is contained in:
Kenneth Gitere 2021-06-09 07:26:52 +03:00
parent 8691b0166f
commit d50bbdfb58
3 changed files with 12 additions and 2 deletions

View file

@ -155,7 +155,13 @@ impl<'a> TryFrom<ArgMatches<'a>> for AppConfig {
arg_matches.is_present("verbosity") && !arg_matches.is_present("log-to-file"), arg_matches.is_present("verbosity") && !arg_matches.is_present("log-to-file"),
) )
.log_level(match arg_matches.occurrences_of("verbosity") { .log_level(match arg_matches.occurrences_of("verbosity") {
0 => LogLevel::Off, 0 => {
if !arg_matches.is_present("log-to-file") {
LogLevel::Off
} else {
LogLevel::Debug
}
}
1 => LogLevel::Error, 1 => LogLevel::Error,
2 => LogLevel::Warn, 2 => LogLevel::Warn,
3 => LogLevel::Info, 3 => LogLevel::Info,

View file

@ -18,6 +18,10 @@ pub fn generate_epubs(
app_config: &AppConfig, app_config: &AppConfig,
successful_articles_table: &mut Table, successful_articles_table: &mut Table,
) -> Result<(), Vec<PaperoniError>> { ) -> Result<(), Vec<PaperoniError>> {
if articles.is_empty() {
return Ok(());
}
let bar = if app_config.can_disable_progress_bar { let bar = if app_config.can_disable_progress_bar {
ProgressBar::hidden() ProgressBar::hidden()
} else { } else {

View file

@ -103,7 +103,7 @@ pub fn serialize_to_xhtml<W: std::io::Write>(
let attrs_str = attrs let attrs_str = attrs
.map .map
.iter() .iter()
.filter(|(k, _)| &k.local != "\"") .filter(|(k, _)| !k.local.contains("\""))
.map(|(k, v)| { .map(|(k, v)| {
format!( format!(
"{}=\"{}\"", "{}=\"{}\"",