feat(table): make missing value symbol configurable (#15647)

Co-authored-by: Bahex <17417311+Bahex@users.noreply.github.com>
This commit is contained in:
Bahex
2025-04-27 23:58:39 +03:00
committed by GitHub
parent 12ccaf5e33
commit d8bec8668f
6 changed files with 54 additions and 6 deletions

View File

@ -340,6 +340,7 @@ pub struct TableConfig {
pub header_on_separator: bool,
pub abbreviated_row_count: Option<usize>,
pub footer_inheritance: bool,
pub missing_value_symbol: String,
}
impl IntoValue for TableConfig {
@ -358,6 +359,7 @@ impl IntoValue for TableConfig {
"header_on_separator" => self.header_on_separator.into_value(span),
"abbreviated_row_count" => abbv_count,
"footer_inheritance" => self.footer_inheritance.into_value(span),
"missing_value_symbol" => self.missing_value_symbol.into_value(span),
}
.into_value(span)
}
@ -374,6 +376,7 @@ impl Default for TableConfig {
padding: TableIndent::default(),
abbreviated_row_count: None,
footer_inheritance: false,
missing_value_symbol: "".into(),
}
}
}
@ -411,6 +414,10 @@ impl UpdateFromValue for TableConfig {
_ => errors.type_mismatch(path, Type::custom("int or nothing"), val),
},
"footer_inheritance" => self.footer_inheritance.update(val, path, errors),
"missing_value_symbol" => match val.as_str() {
Ok(val) => self.missing_value_symbol = val.to_string(),
Err(_) => errors.type_mismatch(path, Type::String, val),
},
_ => errors.unknown_option(path, val),
}
}