]> Dogcows Code - chaz/homebank2ledger/blobdiff - lib/App/HomeBank2Ledger/Formatter/Ledger.pm
Version 0.006
[chaz/homebank2ledger] / lib / App / HomeBank2Ledger / Formatter / Ledger.pm
index 4cf72cb895d169abaa1523139203374396c4270b..ebfa45628a02bb782c723a0a22bf30bb43a036d7 100644 (file)
@@ -10,7 +10,7 @@ use App::HomeBank2Ledger::Util qw(commify rtrim);
 
 use parent 'App::HomeBank2Ledger::Formatter';
 
-our $VERSION = '0.005'; # VERSION
+our $VERSION = '0.006'; # VERSION
 
 my %STATUS_SYMBOLS = (
     cleared => '*',
@@ -157,6 +157,12 @@ sub _format_transaction {
         $memo          && "  ; $memo",
     );
 
+    my $metadata = $transaction->{metadata} || {};
+    for my $key (sort keys %$metadata) {
+        my $value = $self->_format_string($metadata->{$key});
+        push @out, "    ; ${key}: ${value}";
+    }
+
     for my $posting (@postings) {
         my @line;
 
@@ -194,6 +200,12 @@ sub _format_transaction {
 
         push @out, join('', @line);
 
+        my $metadata = $posting->{metadata} || {};
+        for my $key (sort keys %$metadata) {
+            my $value = $self->_format_string($metadata->{$key});
+            push @out, "      ; ${key}: ${value}";
+        }
+
         if (my $posting_payee = $posting->{payee}) {
             $posting_payee = $self->_format_string($posting_payee);
             push @out, "      ; Payee: $posting_payee" if $posting_payee ne $payee;
@@ -255,7 +267,7 @@ App::HomeBank2Ledger::Formatter::Ledger - Ledger formatter
 
 =head1 VERSION
 
-version 0.005
+version 0.006
 
 =head1 DESCRIPTION
 
This page took 0.020067 seconds and 4 git commands to generate.