diff --git a/src/bin/diffenator3.rs b/src/bin/diffenator3.rs index 6d381b9..bd28036 100644 --- a/src/bin/diffenator3.rs +++ b/src/bin/diffenator3.rs @@ -118,19 +118,6 @@ fn main() { } // Location-specific tests - - // let loc_name: String = if let Some(ref loc) = cli.location { - // let _hack = font_a.set_location(loc); - // let _hack = font_b.set_location(loc); - // loc.clone() - // } else if let Some(ref inst) = cli.instance { - // font_a.set_instance(inst).expect("Couldn't find instance"); - // font_b.set_instance(inst).expect("Couldn't find instance"); - // inst.clone() - // } else { - // "default".into() - // }; - let settings: Vec = generate_settings(&cli, &font_a, &font_b); result.locations = settings @@ -145,6 +132,11 @@ fn main() { }) .collect(); + // If there's more than one, filter out the boring ones + if result.locations.len() > 1 { + result.locations.retain(|l| l.is_some()); + } + // Report back if cli.html { reporters::html::report( diff --git a/src/reporters/mod.rs b/src/reporters/mod.rs index e26e8db..3f815bf 100644 --- a/src/reporters/mod.rs +++ b/src/reporters/mod.rs @@ -25,7 +25,7 @@ pub struct LocationResult { } impl LocationResult { - fn is_some(&self) -> bool { + pub fn is_some(&self) -> bool { self.error.is_some() || !self.glyphs.is_empty() || (self.words.is_some() && self.words.as_ref().unwrap().is_something()) diff --git a/src/templates/script.js b/src/templates/script.js index f42753f..9910188 100644 --- a/src/templates/script.js +++ b/src/templates/script.js @@ -86,6 +86,11 @@ $(function () { } cmapDiff_static_html(); $('[data-toggle="tooltip"]').tooltip() + if (!report["locations"]) { + $("#title").html("

No differences found

"); + $("#ui-nav").hide(); + return; + } for (var [index, loc] of report["locations"].entries()) { var loc_nav = $(`