1 use std::borrow::ToOwned;
2 use std::collections::{HashMap, HashSet};
5 use std::iter::Iterator;
7 fn tally_marks(n: usize) -> String {
8 let fives = { 0..n / 5 }.map(|_| '𝍸');
9 let ones = { 0..n % 5 }.map(|_| '𝍷');
10 fives.chain(ones).collect()
13 #[derive(PartialEq, Eq, Debug)]
15 column_threshold: usize,
16 static_columns: Vec<Option<String>>,
17 hidden_columns: HashSet<String>,
18 substitute_labels: HashMap<String, String>,
21 fn apply_command(&mut self, line_num: usize, cmd: &str) -> Result<(), std::io::Error> {
22 if let Some(threshold) = cmd.strip_prefix("col_threshold ") {
23 self.column_threshold = threshold.parse().map_err(|e| {
25 std::io::ErrorKind::InvalidInput,
26 format!("line {line_num}: col_threshold must be numeric: {e}"),
29 } else if let Some(col) = cmd.strip_prefix("hide ") {
30 self.hidden_columns.insert(col.to_owned());
31 } else if let Some(col) = cmd.strip_prefix("col ") {
32 self.static_columns.push(Some(col.to_owned()));
33 } else if cmd == "colsep" {
34 self.static_columns.push(None);
35 } else if let Some(directive) = cmd.strip_prefix("label ") {
36 match directive.split_once(':') {
38 return Err(std::io::Error::new(
39 std::io::ErrorKind::InvalidInput,
40 format!("line {line_num}: Annotation missing ':'"),
43 Some((col, label)) => self
45 .insert(col.to_owned(), label.to_owned()),
48 return Err(std::io::Error::new(
49 std::io::ErrorKind::InvalidInput,
50 format!("line {line_num}: Unknown command: {cmd}"),
56 impl Default for Config {
57 fn default() -> Self {
60 static_columns: vec![],
61 hidden_columns: HashSet::new(),
62 substitute_labels: HashMap::new(),
67 const HEADER: &str = r#"<!DOCTYPE html>
70 <meta charset="utf-8">
71 <meta name="viewport" content="width=device-width, initial-scale=1">
73 td { text-align: center; }
74 /* h/t https://wabain.github.io/2019/10/13/css-rotated-table-header.html */
75 th, td { white-space: nowrap; }
76 th { text-align: left; font-weight: normal; }
77 th.spacer_row { height: .3em; }
78 .spacer_col { border: none; width: .2em; }
79 table { border-collapse: collapse }
80 tr.key > th { height: 10em; vertical-align: bottom; line-height: 1 }
81 tr.key > th > div { width: 1em; }
82 tr.key > th > div > div { width: 5em; transform-origin: bottom left; transform: translateX(1em) rotate(-65deg) }
83 td { border: thin solid gray; }
84 td.leftover { text-align: left; border: none; padding-left: .4em; }
85 td.yes { border: thin solid gray; background-color: #eee; }
86 /* h/t https://stackoverflow.com/questions/5687035/css-bolding-some-text-without-changing-its-containers-size/46452396#46452396 */
87 .highlight { text-shadow: -0.06ex 0 black, 0.06ex 0 black; }
90 function highlight(id) { const e = document.getElementById(id); if (e) { e.classList.add( "highlight"); } }
91 function clear_highlight(id) { const e = document.getElementById(id); if (e) { e.classList.remove("highlight"); } }
92 function h2(a, b) { highlight(a); highlight(b); }
93 function ch2(a, b) { clear_highlight(a); clear_highlight(b); }
100 const FOOTER: &str = " </tbody>
105 #[derive(PartialEq, Eq, Debug)]
106 pub struct HTML(String);
108 fn escape(value: &str) -> HTML {
109 let mut escaped: String = String::new();
110 for c in value.chars() {
112 '>' => escaped.push_str(">"),
113 '<' => escaped.push_str("<"),
114 '\'' => escaped.push_str("'"),
115 '"' => escaped.push_str("""),
116 '&' => escaped.push_str("&"),
117 ok_c => escaped.push(ok_c),
123 impl From<&str> for HTML {
124 fn from(value: &str) -> HTML {
125 HTML(String::from(value))
128 impl FromIterator<HTML> for HTML {
129 fn from_iter<T>(iter: T) -> HTML
131 T: IntoIterator<Item = HTML>,
133 HTML(iter.into_iter().map(|html| html.0).collect::<String>())
136 impl std::fmt::Display for HTML {
137 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
138 write!(f, "{}", self.0)
142 #[derive(Debug, PartialEq, Eq)]
146 Entry(&'a str, Option<&'a str>),
149 impl<'a> From<&'a str> for InputLine<'a> {
150 fn from(value: &'a str) -> InputLine<'a> {
151 let trimmed = value.trim_end();
152 if trimmed.is_empty() {
154 } else if let Some(cmd) = trimmed.strip_prefix('!') {
155 InputLine::Command(cmd)
156 } else if !trimmed.starts_with(' ') {
157 InputLine::RowHeader(value.trim())
159 match value.split_once(':') {
160 None => InputLine::Entry(value.trim(), None),
161 Some((col, instance)) => InputLine::Entry(col.trim(), Some(instance.trim())),
167 #[derive(Debug, PartialEq, Eq)]
170 entries: HashMap<String, Vec<Option<String>>>,
173 #[derive(Debug, PartialEq, Eq)]
179 struct Reader<'cfg, Input: Iterator<Item = Result<String, std::io::Error>>> {
180 input: std::iter::Enumerate<Input>,
182 config: &'cfg mut Config,
184 impl<'cfg, Input: Iterator<Item = Result<String, std::io::Error>>> Reader<'cfg, Input> {
185 fn new(config: &'cfg mut Config, input: Input) -> Self {
187 input: input.enumerate(),
193 impl<'cfg, Input: Iterator<Item = Result<String, std::io::Error>>> Iterator
194 for Reader<'cfg, Input>
196 type Item = Result<Rowlike, std::io::Error>;
197 fn next(&mut self) -> Option<Self::Item> {
199 match self.input.next() {
200 None => return Ok(std::mem::take(&mut self.row).map(Rowlike::Row)).transpose(),
201 Some((_, Err(e))) => return Some(Err(e)),
202 Some((n, Ok(line))) => match InputLine::from(line.as_ref()) {
203 InputLine::Command(cmd) => {
204 if let Err(e) = self.config.apply_command(n + 1, cmd) {
208 InputLine::Blank if self.row.is_some() => {
209 return Ok(std::mem::take(&mut self.row).map(Rowlike::Row)).transpose()
211 InputLine::Blank => return Some(Ok(Rowlike::Spacer)),
212 InputLine::Entry(col, instance) => match &mut self.row {
214 return Some(Err(std::io::Error::other(format!(
215 "line {}: Entry with no header",
219 Some(ref mut row) => {
221 .entry(col.to_owned())
222 .and_modify(|is| is.push(instance.map(ToOwned::to_owned)))
223 .or_insert_with(|| vec![instance.map(ToOwned::to_owned)]);
226 InputLine::RowHeader(row) => {
227 let prev = std::mem::take(&mut self.row);
228 self.row = Some(Row {
229 label: row.to_owned(),
230 entries: HashMap::new(),
233 return Ok(prev.map(Rowlike::Row)).transpose();
242 fn read_input(input: impl std::io::Read) -> Result<(Vec<Rowlike>, Config), std::io::Error> {
243 let mut config = Config::default();
244 let reader = Reader::new(&mut config, std::io::BufReader::new(input).lines());
246 .collect::<Result<Vec<_>, _>>()
247 .map(|rows| (rows, config))
250 fn column_counts(rows: &[Rowlike]) -> Vec<(usize, String)> {
251 let empty = HashMap::new();
252 let mut counts: Vec<_> = rows
254 .flat_map(|rl| match rl {
255 Rowlike::Row(r) => r.entries.keys(),
256 Rowlike::Spacer => empty.keys(),
258 .fold(HashMap::new(), |mut cs, col| {
259 cs.entry(col.to_owned())
260 .and_modify(|n| *n += 1)
265 .map(|(col, n)| (n, col))
267 counts.sort_unstable_by(|(an, acol), (bn, bcol)| bn.cmp(an).then(acol.cmp(bcol)));
270 fn column_order(config: &Config, rows: &[Rowlike]) -> Vec<String> {
271 let static_columns: HashSet<&str> = config
275 .map(std::string::String::as_str)
279 .filter_map(|(n, col)| {
280 (n >= config.column_threshold
281 && !static_columns.contains(col.as_str())
282 && !config.hidden_columns.contains(&col))
288 fn render_instances(instances: &[Option<String>]) -> HTML {
290 let mut out = vec![];
291 for ins in instances {
296 out.push(HTML(tally_marks(tally)));
299 out.push(HTML::escape(content));
304 out.push(HTML(tally_marks(tally)));
308 .map(|html| html.0) // Waiting for slice_concat_trait to stabilize
314 fn render_cell(config: &Config, col: &str, row: &mut Row) -> HTML {
315 let row_label = HTML::escape(row.label.as_ref());
316 let col_label = HTML::escape(
320 .map_or(col, std::string::String::as_str),
322 let instances: Option<&Vec<Option<String>>> = row.entries.get(col);
323 let is_empty = match instances {
325 Some(is) => is.iter().all(|ins| match ins {
327 Some(content) => content == "×",
330 let class = HTML::from(if is_empty { "" } else { r#" class="yes""# });
331 let contents = match instances {
332 None => HTML::from(""),
333 Some(is) => render_instances(is),
335 row.entries.remove(col);
337 r#"<td{class} onmouseover="h2('{row_label}','{col_label}')" onmouseout="ch2('{row_label}','{col_label}')">{contents}</td>"#
341 fn render_leftover(notcol: &str, instances: &[Option<String>]) -> HTML {
342 let label = HTML::escape(notcol);
343 if instances.len() == 1 && instances[0].is_none() {
344 HTML(format!("{label}"))
346 let rest = render_instances(instances);
347 HTML(format!("{label}: {rest}"))
351 fn render_all_leftovers(config: &Config, row: &Row) -> HTML {
352 let mut order: Vec<_> = row
355 .filter(|&col| !config.hidden_columns.contains(col))
357 order.sort_unstable();
361 .map(|notcol| render_leftover(notcol, row.entries.get(notcol).expect("Key vanished?!")))
362 .map(|html| html.0) // Waiting for slice_concat_trait to stabilize
368 fn render_row(config: &Config, columns: &[String], rowlike: &mut Rowlike) -> HTML {
370 Rowlike::Spacer => HTML::from("<tr><th class=\"spacer_row\"></th></tr>\n"),
371 Rowlike::Row(row) => {
372 let row_label = HTML::escape(row.label.as_ref());
373 let static_cells = config
376 .map(|ocol| match ocol {
377 Some(col) if config.hidden_columns.contains(col) => HTML::from(""),
378 Some(col) => render_cell(config, col, row),
379 None => HTML::from(r#"<td class="spacer_col"></td>"#),
382 let dynamic_cells = columns
384 .filter(|&col| !config.hidden_columns.contains(col))
385 .map(|col| render_cell(config, col, row))
387 let leftovers = render_all_leftovers(config, row);
389 "<tr><th id=\"{row_label}\">{row_label}</th>{static_cells}{dynamic_cells}<td class=\"leftover\" onmouseover=\"highlight('{row_label}')\" onmouseout=\"clear_highlight('{row_label}')\">{leftovers}</td></tr>\n"
395 fn column_header_labels<'a>(
397 columns: &'a [String],
398 ) -> impl Iterator<Item = Option<&'a String>> {
399 let static_columns = config.static_columns.iter().map(|oc| oc.as_ref());
400 let dynamic_columns = columns.iter().map(Some);
402 .chain(dynamic_columns)
403 .filter(|ocol| ocol.map_or(true, |col| !config.hidden_columns.contains(col)))
405 ocol.map(|col| match config.substitute_labels.get(col) {
407 Some(substitute) => substitute,
412 fn render_column_headers(config: &Config, columns: &[String]) -> HTML {
414 String::from(r#"<tr class="key"><th></th>"#)
415 + &column_header_labels(config, columns).fold(String::new(), |mut acc, ocol| {
418 let col_header = HTML::escape(col);
421 r#"<th id="{col_header}"><div><div>{col_header}</div></div></th>"#
424 None => write!(&mut acc, r#"<th class="col_spacer"></th>"#),
435 /// Will return `Err` if
436 /// * there's an i/o error while reading `input`
437 /// * the log has invalid syntax:
438 /// * an indented line with no preceding non-indented line
439 pub fn tablify(input: impl std::io::Read) -> Result<HTML, std::io::Error> {
440 let (rows, config) = read_input(input)?;
441 let columns = column_order(&config, &rows);
443 "{HEADER}{}{}{FOOTER}",
444 render_column_headers(&config, &columns),
446 .map(|mut r| render_row(&config, &columns, &mut r))
456 fn test_parse_line() {
457 assert_eq!(InputLine::from(""), InputLine::Blank);
458 assert_eq!(InputLine::from(" "), InputLine::Blank);
459 assert_eq!(InputLine::from("foo"), InputLine::RowHeader("foo"));
460 assert_eq!(InputLine::from("foo "), InputLine::RowHeader("foo"));
461 assert_eq!(InputLine::from(" foo"), InputLine::Entry("foo", None));
463 InputLine::from(" foo:bar"),
464 InputLine::Entry("foo", Some("bar"))
467 InputLine::from(" foo: bar"),
468 InputLine::Entry("foo", Some("bar"))
471 InputLine::from(" foo: bar "),
472 InputLine::Entry("foo", Some("bar"))
475 InputLine::from(" foo: bar "),
476 InputLine::Entry("foo", Some("bar"))
479 InputLine::from(" foo : bar "),
480 InputLine::Entry("foo", Some("bar"))
485 fn test_tally_marks() {
486 assert_eq!(tally_marks(1), "𝍷");
487 assert_eq!(tally_marks(2), "𝍷𝍷");
488 assert_eq!(tally_marks(3), "𝍷𝍷𝍷");
489 assert_eq!(tally_marks(4), "𝍷𝍷𝍷𝍷");
490 assert_eq!(tally_marks(5), "𝍸");
491 assert_eq!(tally_marks(6), "𝍸𝍷");
492 assert_eq!(tally_marks(7), "𝍸𝍷𝍷");
493 assert_eq!(tally_marks(8), "𝍸𝍷𝍷𝍷");
494 assert_eq!(tally_marks(9), "𝍸𝍷𝍷𝍷𝍷");
495 assert_eq!(tally_marks(10), "𝍸𝍸");
496 assert_eq!(tally_marks(11), "𝍸𝍸𝍷");
499 fn read_rows(input: impl std::io::Read) -> Result<Vec<Rowlike>, std::io::Error> {
500 read_input(input).map(|(rows, _)| rows)
502 fn read_config(input: impl std::io::Read) -> Result<Config, std::io::Error> {
503 read_input(input).map(|(_, config)| config)
506 fn test_read_rows() {
508 read_rows(&b"foo"[..]).unwrap(),
509 vec![Rowlike::Row(Row {
510 label: "foo".to_owned(),
511 entries: HashMap::new(),
515 read_rows(&b"bar"[..]).unwrap(),
516 vec![Rowlike::Row(Row {
517 label: "bar".to_owned(),
518 entries: HashMap::new(),
522 read_rows(&b"foo\nbar\n"[..]).unwrap(),
525 label: "foo".to_owned(),
526 entries: HashMap::new(),
529 label: "bar".to_owned(),
530 entries: HashMap::new(),
535 read_rows(&b"foo\n bar\n"[..]).unwrap(),
536 vec![Rowlike::Row(Row {
537 label: "foo".to_owned(),
538 entries: HashMap::from([("bar".to_owned(), vec![None])]),
542 read_rows(&b"foo\n bar\n baz\n"[..]).unwrap(),
543 vec![Rowlike::Row(Row {
544 label: "foo".to_owned(),
545 entries: HashMap::from([
546 ("bar".to_owned(), vec![None]),
547 ("baz".to_owned(), vec![None])
552 read_rows(&b"foo\n\nbar\n"[..]).unwrap(),
555 label: "foo".to_owned(),
556 entries: HashMap::new(),
559 label: "bar".to_owned(),
560 entries: HashMap::new(),
565 read_rows(&b"foo\n\n\nbar\n"[..]).unwrap(),
568 label: "foo".to_owned(),
569 entries: HashMap::new(),
573 label: "bar".to_owned(),
574 entries: HashMap::new(),
579 read_rows(&b"foo\n \nbar\n"[..]).unwrap(),
582 label: "foo".to_owned(),
583 entries: HashMap::new(),
586 label: "bar".to_owned(),
587 entries: HashMap::new(),
592 read_rows(&b"foo \n bar \n"[..]).unwrap(),
593 vec![Rowlike::Row(Row {
594 label: "foo".to_owned(),
595 entries: HashMap::from([("bar".to_owned(), vec![None])]),
599 let bad = read_rows(&b" foo"[..]);
600 assert!(bad.is_err());
601 assert!(format!("{bad:?}").contains("line 1: Entry with no header"));
603 let bad2 = read_rows(&b"foo\n\n bar"[..]);
604 assert!(bad2.is_err());
605 assert!(format!("{bad2:?}").contains("line 3: Entry with no header"));
609 fn test_read_config() {
611 read_config(&b"!col_threshold 10"[..])
617 read_config(&b"!col foo"[..]).unwrap().static_columns,
618 vec![Some("foo".to_owned())]
621 read_config(&b"!label foo:bar"[..])
623 .substitute_labels["foo"],
627 let bad_command = read_config(&b"!no such command"[..]);
628 assert!(bad_command.is_err());
629 assert!(format!("{bad_command:?}").contains("line 1: Unknown command"));
631 let bad_num = read_config(&b"!col_threshold foo"[..]);
632 assert!(bad_num.is_err());
633 assert!(format!("{bad_num:?}").contains("line 1: col_threshold must be numeric"));
635 let bad_sub = read_config(&b"!label foo"[..]);
636 assert!(bad_sub.is_err());
637 assert!(format!("{bad_sub:?}").contains("line 1: Annotation missing ':'"));
641 fn test_column_counts() {
643 column_counts(&read_rows(&b"foo\n bar\n baz\n"[..]).unwrap()),
644 vec![(1, String::from("bar")), (1, String::from("baz"))]
647 column_counts(&read_rows(&b"foo\n bar\n baz\nquux\n baz"[..]).unwrap()),
648 vec![(2, String::from("baz")), (1, String::from("bar"))]
651 column_counts(&read_rows(&b"foo\n bar\n bar\n baz\n bar\nquux\n baz"[..]).unwrap()),
652 vec![(2, String::from("baz")), (1, String::from("bar"))]
656 &read_rows(&b"foo\n bar: 1\n bar: 2\n baz\n bar\nquux\n baz"[..]).unwrap()
658 vec![(2, String::from("baz")), (1, String::from("bar"))]
663 fn test_column_header_labels() {
664 let mut cfg = Config::default();
666 assert!(column_header_labels(&cfg, &["foo".to_owned()]).eq([Some(&"foo".to_owned())]));
668 cfg.static_columns.push(Some("bar".to_owned()));
669 assert!(column_header_labels(&cfg, &["foo".to_owned()])
670 .eq([Some(&"bar".to_owned()), Some(&"foo".to_owned())]));
672 cfg.static_columns.push(None);
673 assert!(column_header_labels(&cfg, &["foo".to_owned()]).eq([
674 Some(&"bar".to_owned()),
676 Some(&"foo".to_owned())
679 cfg.substitute_labels
680 .insert("foo".to_owned(), "foo (bits)".to_owned());
681 assert!(column_header_labels(&cfg, &["foo".to_owned()]).eq([
682 Some(&"bar".to_owned()),
684 Some(&"foo (bits)".to_owned())
687 cfg.hidden_columns.insert("foo".to_owned());
688 assert!(column_header_labels(&cfg, &["foo".to_owned()]).eq([Some(&"bar".to_owned()), None]));
690 cfg.hidden_columns.insert("bar".to_owned());
691 assert!(column_header_labels(&cfg, &["foo".to_owned()]).eq([None]));
695 fn test_render_cell() {
701 label: "nope".to_owned(),
702 entries: HashMap::new(),
706 r#"<td onmouseover="h2('nope','foo')" onmouseout="ch2('nope','foo')"></td>"#
714 label: "nope".to_owned(),
715 entries: HashMap::from([("bar".to_owned(), vec![None])]),
719 r#"<td onmouseover="h2('nope','foo')" onmouseout="ch2('nope','foo')"></td>"#
727 label: "nope".to_owned(),
728 entries: HashMap::from([("foo".to_owned(), vec![None])]),
732 r#"<td class="yes" onmouseover="h2('nope','foo')" onmouseout="ch2('nope','foo')">𝍷</td>"#
740 label: "nope".to_owned(),
741 entries: HashMap::from([("foo".to_owned(), vec![None, None])]),
745 r#"<td class="yes" onmouseover="h2('nope','foo')" onmouseout="ch2('nope','foo')">𝍷𝍷</td>"#
753 label: "nope".to_owned(),
754 entries: HashMap::from([(
756 vec![Some("5".to_owned()), Some("10".to_owned())]
761 r#"<td class="yes" onmouseover="h2('nope','foo')" onmouseout="ch2('nope','foo')">5 10</td>"#
769 label: "nope".to_owned(),
770 entries: HashMap::from([("foo".to_owned(), vec![Some("5".to_owned()), None])]),
774 r#"<td class="yes" onmouseover="h2('nope','foo')" onmouseout="ch2('nope','foo')">5 𝍷</td>"#
782 label: "nope".to_owned(),
783 entries: HashMap::from([("foo".to_owned(), vec![Some("×".to_owned())])]),
787 r#"<td onmouseover="h2('nope','foo')" onmouseout="ch2('nope','foo')">×</td>"#
795 label: "nope".to_owned(),
796 entries: HashMap::from([("heart".to_owned(), vec![Some("<3".to_owned())])]),
800 r#"<td class="yes" onmouseover="h2('nope','heart')" onmouseout="ch2('nope','heart')"><3</td>"#
808 label: "bob's".to_owned(),
809 entries: HashMap::from([("foo".to_owned(), vec![None])]),
813 r#"<td class="yes" onmouseover="h2('bob's','foo')" onmouseout="ch2('bob's','foo')">𝍷</td>"#
817 label: "nope".to_owned(),
818 entries: HashMap::from([
819 ("foo".to_owned(), vec![None]),
820 ("baz".to_owned(), vec![None]),
823 assert_eq!(r.entries.len(), 2);
824 render_cell(&Config::default(), "foo", &mut r);
825 assert_eq!(r.entries.len(), 1);
826 render_cell(&Config::default(), "bar", &mut r);
827 assert_eq!(r.entries.len(), 1);
828 render_cell(&Config::default(), "baz", &mut r);
829 assert_eq!(r.entries.len(), 0);
833 fn test_render_leftovers() {
835 render_all_leftovers(
838 label: "nope".to_owned(),
839 entries: HashMap::from([("foo".to_owned(), vec![None])]),
845 render_all_leftovers(
848 label: "nope".to_owned(),
849 entries: HashMap::from([
850 ("foo".to_owned(), vec![None]),
851 ("bar".to_owned(), vec![None])
855 HTML::from("bar, foo")
858 render_all_leftovers(
861 label: "nope".to_owned(),
862 entries: HashMap::from([
863 ("foo".to_owned(), vec![None]),
864 ("bar".to_owned(), vec![None, None])
868 HTML::from("bar: 𝍷𝍷, foo")
871 render_all_leftovers(
874 static_columns: vec![],
875 hidden_columns: HashSet::from(["private".to_owned()]),
876 substitute_labels: HashMap::new(),
879 label: "nope".to_owned(),
880 entries: HashMap::from([("private".to_owned(), vec![None]),]),
888 fn test_render_row() {
893 &mut Rowlike::Row(Row {
894 label: "nope".to_owned(),
895 entries: HashMap::from([("bar".to_owned(), vec![None])]),
899 r#"<tr><th id="nope">nope</th><td onmouseover="h2('nope','foo')" onmouseout="ch2('nope','foo')"></td><td class="leftover" onmouseover="highlight('nope')" onmouseout="clear_highlight('nope')">bar</td></tr>
907 static_columns: vec![Some("foo".to_owned()), Some("bar".to_owned())],
908 hidden_columns: HashSet::new(),
909 substitute_labels: HashMap::new(),
912 &mut Rowlike::Row(Row {
913 label: "nope".to_owned(),
914 entries: HashMap::from([
915 ("bar".to_owned(), vec![Some("r".to_owned())]),
916 ("baz".to_owned(), vec![Some("z".to_owned())]),
917 ("foo".to_owned(), vec![Some("f".to_owned())]),
922 r#"<tr><th id="nope">nope</th><td class="yes" onmouseover="h2('nope','foo')" onmouseout="ch2('nope','foo')">f</td><td class="yes" onmouseover="h2('nope','bar')" onmouseout="ch2('nope','bar')">r</td><td class="yes" onmouseover="h2('nope','baz')" onmouseout="ch2('nope','baz')">z</td><td class="leftover" onmouseover="highlight('nope')" onmouseout="clear_highlight('nope')"></td></tr>
930 static_columns: vec![Some("foo".to_owned()), None, Some("bar".to_owned())],
931 hidden_columns: HashSet::new(),
932 substitute_labels: HashMap::new(),
935 &mut Rowlike::Row(Row {
936 label: "nope".to_owned(),
937 entries: HashMap::from([
938 ("bar".to_owned(), vec![Some("r".to_owned())]),
939 ("foo".to_owned(), vec![Some("f".to_owned())]),
944 r#"<tr><th id="nope">nope</th><td class="yes" onmouseover="h2('nope','foo')" onmouseout="ch2('nope','foo')">f</td><td class="spacer_col"></td><td class="yes" onmouseover="h2('nope','bar')" onmouseout="ch2('nope','bar')">r</td><td class="leftover" onmouseover="highlight('nope')" onmouseout="clear_highlight('nope')"></td></tr>
952 static_columns: vec![],
953 hidden_columns: HashSet::from(["foo".to_owned()]),
954 substitute_labels: HashMap::new(),
957 &mut Rowlike::Row(Row {
958 label: "nope".to_owned(),
959 entries: HashMap::from([("foo".to_owned(), vec![Some("f".to_owned())]),]),
963 r#"<tr><th id="nope">nope</th><td class="leftover" onmouseover="highlight('nope')" onmouseout="clear_highlight('nope')"></td></tr>
971 static_columns: vec![Some("foo".to_owned())],
972 hidden_columns: HashSet::from(["foo".to_owned()]),
973 substitute_labels: HashMap::new(),
976 &mut Rowlike::Row(Row {
977 label: "nope".to_owned(),
978 entries: HashMap::from([("foo".to_owned(), vec![Some("f".to_owned())]),]),
982 r#"<tr><th id="nope">nope</th><td class="leftover" onmouseover="highlight('nope')" onmouseout="clear_highlight('nope')"></td></tr>
990 static_columns: vec![],
991 hidden_columns: HashSet::new(),
992 substitute_labels: HashMap::from([("foo".to_owned(), "bar".to_owned())]),
995 &mut Rowlike::Row(Row {
996 label: "nope".to_owned(),
997 entries: HashMap::from([("foo".to_owned(), vec![None])]),
1001 r#"<tr><th id="nope">nope</th><td class="yes" onmouseover="h2('nope','bar')" onmouseout="ch2('nope','bar')">𝍷</td><td class="leftover" onmouseover="highlight('nope')" onmouseout="clear_highlight('nope')"></td></tr>