fn render_cell(config: &Config, col: &str, row: &mut Row) -> HTML {
let row_label = HTML::escape(row.label.as_ref());
- let col_label = HTML::escape(col);
+ let col_label = HTML::escape(
+ config
+ .substitute_labels
+ .get(col)
+ .map_or(col, std::string::String::as_str),
+ );
let instances: Option<&Vec<Option<String>>> = row.entries.get(col);
let is_empty = match instances {
None => true,
),
HTML::from(
r#"<tr><th id="nope">nope</th><td class="leftover" onmouseover="highlight('nope')" onmouseout="clear_highlight('nope')"></td></tr>
+"#
+ )
+ );
+ assert_eq!(
+ render_row(
+ &Config {
+ column_threshold: 0,
+ static_columns: vec![],
+ hidden_columns: HashSet::new(),
+ substitute_labels: HashMap::from([("foo".to_owned(), "bar".to_owned())]),
+ },
+ &["foo".to_owned()],
+ &mut Rowlike::Row(Row {
+ label: "nope".to_owned(),
+ entries: HashMap::from([("foo".to_owned(), vec![None])]),
+ })
+ ),
+ HTML::from(
+ 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>
"#
)
);