From 29359f3a878c6017bb00f2aa8fcac91a2af5ddc5 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 12 Nov 2012 01:37:14 -0600 Subject: Account names in auto-xacts can be format strings --- src/xact.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/xact.cc') diff --git a/src/xact.cc b/src/xact.cc index ec1d372c..cac19a02 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -36,6 +36,7 @@ #include "account.h" #include "journal.h" #include "context.h" +#include "format.h" #include "pool.h" namespace ledger { @@ -775,6 +776,14 @@ void auto_xact_t::extend_xact(xact_base_t& xact, parse_context_t& context) account = account->parent; account = account->find_account(fullname); } + else if (contains(fullname, "%")) { + format_t account_name(fullname); + std::ostringstream buf; + buf << account_name(bound_scope); + while (account->parent) + account = account->parent; + account = account->find_account(buf.str()); + } // Copy over details so that the resulting post is a mirror of // the automated xact's one. -- cgit v1.2.3