Get formatted header. For example,
- ; Converted from finances.xhb using homebank2ledger 0.001
+ ; Name: My Finances
+ ; File: path/to/finances.xhb
=cut
if (my $name = $self->name) {
push @out, "; Name: $name";
}
-
- my $file = $self->file;
- push @out, "; Converted from ${file} using homebank2ledger ${VERSION}";
+ if (my $file = $self->file) {
+ push @out, "; File: $file";
+ }
push @out, '';
return $str;
}
+sub _quote_string {
+ my $self = shift;
+ my $str = shift;
+ $str =~ s/"/\\"/g;
+ return "\"$str\"";
+}
+
sub _format_amount {
my $self = shift;
my $amount = shift;
my $num = join($commodity->{dchar}, commify($whole, $commodity->{gchar}), $fraction);
- $num = $commodity->{syprf} ? "$commodity->{symbol} $num" : "$num $commodity->{symbol}";
+ my $symbol = $commodity->{symbol};
+ $symbol = $self->_quote_string($symbol) if $symbol =~ /[0-9\s]/;
+
+ $num = $commodity->{syprf} ? "$symbol $num" : "$num $symbol";
return $num;
}