diff options
author | John Wiegley <johnw@newartisans.com> | 2009-03-03 15:06:15 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-03-03 15:06:15 -0400 |
commit | 4af1bfdde3118b6abc19ca87ef99d42bec58197b (patch) | |
tree | d5e55db57e8991d7dce0ecb94a275ddd48051e55 /src/report.h | |
parent | de3bafc0d75410a86f13d63411271bf09fde3d6f (diff) | |
download | fork-ledger-4af1bfdde3118b6abc19ca87ef99d42bec58197b.tar.gz fork-ledger-4af1bfdde3118b6abc19ca87ef99d42bec58197b.tar.bz2 fork-ledger-4af1bfdde3118b6abc19ca87ef99d42bec58197b.zip |
Allow special %{} formatting sequence
Although %(amount) inserts an item's amount, it only does exactly that.
There is no special consideration like stripping of lot details, or
reduction to the base commodity, etc. For those things, and to make
sure it was display in red if negative, the canonical form would be:
%(ansify_if(justify(scrub(amount), 12, -1, true), red if amount < 0))
You can now use the special %{} form as an alternate to this:
%12{amount, red if amount < 0}
The two expand to the same underlying expression.
Diffstat (limited to 'src/report.h')
-rw-r--r-- | src/report.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/report.h b/src/report.h index 72f0af57..7bca98b8 100644 --- a/src/report.h +++ b/src/report.h @@ -237,12 +237,12 @@ public: }); OPTION__(report_t, balance_format_, CTOR(report_t, balance_format_) { - on("%(ansify_if(justify(scrub(display_total), 20, -1, true), \"red\", " - " color & scrub(display_total) < 0))" + on("%(ansify_if(justify(scrub(display_total), 20, -1, true), " + " red if color & scrub(display_total) < 0))" " %(!options.flat ? depth_spacer : \"\")" - "%-(ansify_if(partial_account(options.flat), \"blue\", color))\n%/" - "%(ansify_if(justify(scrub(display_total), 20, -1, true), \"red\", " - " color & scrub(display_total) < 0))\n%/" + "%-(ansify_if(partial_account(options.flat), blue if color))\n%/" + "%(ansify_if(justify(scrub(display_total), 20, -1, true), " + " red if color & scrub(display_total) < 0))\n%/" "--------------------\n"); }); @@ -551,26 +551,26 @@ public: }); OPTION__(report_t, register_format_, CTOR(report_t, register_format_) { - on("%(ansify_if(justify(date, date_width), \"green\", color & date > today))" + on("%(ansify_if(justify(date, date_width), green if color & date > today))" " %(ansify_if(justify(truncated(payee, payee_width), payee_width), " - " \"bold\", color & !cleared))" + " bold if color & !cleared))" " %(ansify_if(justify(truncated(account, account_width, abbrev_len), " - " account_width), \"blue\", color))" + " account_width), blue if color))" " %(ansify_if(justify(scrub(display_amount), amount_width, " " 3 + date_width + payee_width + account_width + amount_width, true), " - " \"red\", color & scrub(display_amount) < 0))" + " red if color & scrub(display_amount) < 0))" " %(ansify_if(justify(scrub(display_total), total_width, " " 4 + date_width + payee_width + account_width + amount_width " - " + total_width, true), \"red\", color & scrub(display_amount) < 0))\n%/" + " + total_width, true), red if color & scrub(display_amount) < 0))\n%/" "%(justify(\" \", 2 + date_width + payee_width))" "%(ansify_if(justify(truncated(account, account_width, abbrev_len), " - " account_width), \"blue\", color))" + " account_width), blue if color))" " %(ansify_if(justify(scrub(display_amount), amount_width, " " 3 + date_width + payee_width + account_width + amount_width, true), " - " \"red\", color & scrub(display_amount) < 0))" + " red if color & scrub(display_amount) < 0))" " %(ansify_if(justify(scrub(display_total), total_width, " " 4 + date_width + payee_width + account_width + amount_width " - " + total_width, true), \"red\", color & scrub(display_amount) < 0))\n"); + " + total_width, true), red if color & scrub(display_amount) < 0))\n"); }); OPTION(report_t, related); // -r |