]> git.scottworley.com Git - tablify/blobdiff - src/lib.rs
Release 0.2.1
[tablify] / src / lib.rs
index efdb7d812ec7c98724518d883f214b40871601a3..fbafcb1726863ebac3aba8407b174820a1038c56 100644 (file)
@@ -13,7 +13,7 @@ const HEADER: &str = "<!DOCTYPE html>
     th, td { white-space: nowrap; }
     th { text-align: left; font-weight: normal; }
     table { border-collapse: collapse }
-    tr.key > th { height: 8em; vertical-align: bottom; line-height: 1 }
+    tr.key > th { height: 10em; vertical-align: bottom; line-height: 1 }
     tr.key > th > div { width: 1em; }
     tr.key > th > div > div { width: 5em; transform-origin: bottom left; transform: translateX(1em) rotate(-65deg) }
     td { border: thin solid gray; }
@@ -137,7 +137,7 @@ fn column_counts(rows: &[RowInput]) -> Vec<(usize, String)> {
         .into_iter()
         .map(|(col, n)| (n, col))
         .collect();
-    counts.sort();
+    counts.sort_unstable_by(|(an, acol), (bn, bcol)| bn.cmp(an).then(acol.cmp(bcol)));
     counts
 }
 fn column_order(rows: &[RowInput]) -> Vec<String> {
@@ -353,7 +353,7 @@ mod tests {
                     .collect::<Result<Vec<_>, _>>()
                     .unwrap()
             ),
-            vec![(1, String::from("bar")), (2, String::from("baz"))]
+            vec![(2, String::from("baz")), (1, String::from("bar"))]
         );
         assert_eq!(
             column_counts(
@@ -361,7 +361,7 @@ mod tests {
                     .collect::<Result<Vec<_>, _>>()
                     .unwrap()
             ),
-            vec![(1, String::from("bar")), (2, String::from("baz"))]
+            vec![(2, String::from("baz")), (1, String::from("bar"))]
         );
         assert_eq!(
             column_counts(
@@ -369,7 +369,7 @@ mod tests {
                     .collect::<Result<Vec<_>, _>>()
                     .unwrap()
             ),
-            vec![(1, String::from("bar")), (2, String::from("baz"))]
+            vec![(2, String::from("baz")), (1, String::from("bar"))]
         );
     }