summaryrefslogtreecommitdiff
path: root/src/report.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-22 01:16:29 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-22 01:27:05 -0400
commit81bf38584e43e5fc31e316246f11e210418548a9 (patch)
treef1a99e54d63737fcfd4ed4e48c6f9cd6b431bcc1 /src/report.h
parent7d005b8d98b5547e5847895140d52a2707545ed5 (diff)
downloadfork-ledger-81bf38584e43e5fc31e316246f11e210418548a9.tar.gz
fork-ledger-81bf38584e43e5fc31e316246f11e210418548a9.tar.bz2
fork-ledger-81bf38584e43e5fc31e316246f11e210418548a9.zip
Added new --bold-if option
Diffstat (limited to 'src/report.h')
-rw-r--r--src/report.h64
1 files changed, 48 insertions, 16 deletions
diff --git a/src/report.h b/src/report.h
index e0073193..fc2fc1a2 100644
--- a/src/report.h
+++ b/src/report.h
@@ -140,6 +140,7 @@ public:
value_t fn_total_expr(call_scope_t& scope);
value_t fn_display_amount(call_scope_t& scope);
value_t fn_display_total(call_scope_t& scope);
+ value_t fn_should_bold(call_scope_t& scope);
value_t fn_market(call_scope_t& scope);
value_t fn_get_at(call_scope_t& scope);
value_t fn_is_seq(call_scope_t& scope);
@@ -379,9 +380,13 @@ public:
OPTION__(report_t, balance_format_, CTOR(report_t, balance_format_) {
on(none,
- "%(justify(scrub(display_total), 20, 20 + prepend_width, true, color))"
+ "%(ansify_if("
+ " justify(scrub(display_total), 20, 20 + prepend_width, true, color),"
+ " bold if should_bold))"
" %(!options.flat ? depth_spacer : \"\")"
- "%-(ansify_if(partial_account(options.flat), blue if color))\n%/"
+ "%-(ansify_if("
+ " ansify_if(partial_account(options.flat), blue if color),"
+ " bold if should_bold))\n%/"
"%$1\n%/"
"--------------------\n");
});
@@ -405,6 +410,18 @@ public:
parent->HANDLER(limit_).on(string("--begin"), predicate);
});
+ OPTION__
+ (report_t, bold_if_,
+ expr_t expr;
+ CTOR(report_t, bold_if_) {}
+ void set_expr(const optional<string>& whence, const string& str) {
+ expr = str;
+ on(whence, str);
+ }
+ DO_(args) {
+ set_expr(args.get<string>(0), args.get<string>(1));
+ });
+
OPTION_(report_t, budget, DO() {
parent->budget_flags |= BUDGET_BUDGETED;
});
@@ -808,21 +825,36 @@ public:
OPTION__(report_t, register_format_, CTOR(report_t, register_format_) {
on(none,
- "%(ansify_if(justify(format_date(date), date_width), green "
- " if color & date > today))"
- " %(ansify_if(justify(truncated(payee, payee_width), payee_width), "
- " bold if color & !cleared & actual))"
- " %(ansify_if(justify(truncated(display_account, account_width, "
- " abbrev_len), account_width), blue if color))"
- " %(justify(scrub(display_amount), amount_width, "
- " 3 + meta_width + date_width + payee_width + account_width"
- " + amount_width + prepend_width, true, color))"
- " %(justify(scrub(display_total), total_width, "
- " 4 + meta_width + date_width + payee_width + account_width"
- " + amount_width + total_width + prepend_width, true, color))\n%/"
+ "%(ansify_if("
+ " ansify_if(justify(format_date(date), date_width),"
+ " green if color and date > today),"
+ " bold if should_bold))"
+ " %(ansify_if("
+ " ansify_if(justify(truncated(payee, payee_width), payee_width), "
+ " bold if color and !cleared and actual),"
+ " bold if should_bold))"
+ " %(ansify_if("
+ " ansify_if(justify(truncated(display_account, account_width, "
+ " abbrev_len), account_width),"
+ " blue if color),"
+ " bold if should_bold))"
+ " %(ansify_if("
+ " justify(scrub(display_amount), amount_width, "
+ " 3 + meta_width + date_width + payee_width"
+ " + account_width + amount_width + prepend_width,"
+ " true, color),"
+ " bold if should_bold))"
+ " %(ansify_if("
+ " justify(scrub(display_total), total_width, "
+ " 4 + meta_width + date_width + payee_width"
+ " + account_width + amount_width + total_width"
+ " + prepend_width, true, color),"
+ " bold if should_bold))\n%/"
"%(justify(\" \", date_width))"
- " %(justify(truncated(has_tag(\"Payee\") ? payee : \" \", "
- " payee_width), payee_width))"
+ " %(ansify_if("
+ " justify(truncated(has_tag(\"Payee\") ? payee : \" \", "
+ " payee_width), payee_width),"
+ " bold if should_bold))"
" %$3 %$4 %$5\n");
});