mirror of https://github.com/digint/btrbk
btrbk: add empty_cell_char argument to print_formatted
parent
f3eb1ecb95
commit
713fe50372
4
btrbk
4
btrbk
|
@ -5059,6 +5059,7 @@ sub print_formatted(@)
|
||||||
my $ralign = $table_format->{RALIGN} // {};
|
my $ralign = $table_format->{RALIGN} // {};
|
||||||
my $fh = $args{outfile} // *STDOUT;
|
my $fh = $args{outfile} // *STDOUT;
|
||||||
my $table_spacing = 2;
|
my $table_spacing = 2;
|
||||||
|
my $empty_cell_char = $args{empty_cell_char} // "-";
|
||||||
|
|
||||||
if($format =~ s/^col:\s*(h:)?\s*//) {
|
if($format =~ s/^col:\s*(h:)?\s*//) {
|
||||||
$args{no_header} = 1 if($1);
|
$args{no_header} = 1 if($1);
|
||||||
|
@ -5120,8 +5121,7 @@ sub print_formatted(@)
|
||||||
$val = join(',', @{$val});
|
$val = join(',', @{$val});
|
||||||
}
|
}
|
||||||
$print_row{$key} = 1 if(defined($val));
|
$print_row{$key} = 1 if(defined($val));
|
||||||
$val //= "-";
|
$val = $empty_cell_char if(!defined($val) || ($val eq ""));
|
||||||
$val = "-" if($val eq "");
|
|
||||||
$row->{$key} = $val; # write back the sanitized value
|
$row->{$key} = $val; # write back the sanitized value
|
||||||
$maxlen{$key} = length($val) if($maxlen{$key} < length($val));
|
$maxlen{$key} = length($val) if($maxlen{$key} < length($val));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue