summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--format.cc29
-rw-r--r--format.h3
2 files changed, 31 insertions, 1 deletions
diff --git a/format.cc b/format.cc
index 7b3012bb..7d1748c1 100644
--- a/format.cc
+++ b/format.cc
@@ -180,6 +180,9 @@ element_t * format_t::parse_elements(const std::string& fmt)
current->chars = format_t::date_format;
break;
+ case 'S': current->type = element_t::SOURCE; break;
+ case 'B': current->type = element_t::BEG_POS; break;
+ case 'E': current->type = element_t::END_POS; break;
case 'X': current->type = element_t::CLEARED; break;
case 'C': current->type = element_t::CODE; break;
case 'P': current->type = element_t::PAYEE; break;
@@ -296,7 +299,8 @@ void format_t::format(std::ostream& out_str, const details_t& details) const
if (! has_flag)
unit_cost.commodity().flags &= ~COMMODITY_STYLE_VARIABLE;
- } else {
+ }
+ else if (details.entry) {
unsigned int xacts_count = 0;
transaction_t * first = NULL;
transaction_t * last = NULL;
@@ -324,6 +328,29 @@ void format_t::format(std::ostream& out_str, const details_t& details) const
}
break;
+ case element_t::SOURCE:
+ if (details.entry) {
+ int idx = details.entry->src_idx;
+ for (strings_list::iterator i = details.entry->journal->sources.begin();
+ i != details.entry->journal->sources.end();
+ i++)
+ if (! idx--) {
+ out << *i;
+ break;
+ }
+ }
+ break;
+
+ case element_t::BEG_POS:
+ if (details.entry)
+ out << (unsigned long)details.entry->beg_pos;
+ break;
+
+ case element_t::END_POS:
+ if (details.entry)
+ out << (unsigned long)details.entry->end_pos;
+ break;
+
case element_t::DATE_STRING:
if (details.entry && details.entry->date) {
char buf[256];
diff --git a/format.h b/format.h
index 37e5e21a..3d45a2d0 100644
--- a/format.h
+++ b/format.h
@@ -17,6 +17,9 @@ struct element_t
enum kind_t {
STRING,
VALUE_EXPR,
+ SOURCE,
+ BEG_POS,
+ END_POS,
DATE_STRING,
CLEARED,
CODE,