Changed how comments are output to be more logical
This commit is contained in:
parent
9a23b73491
commit
ad42447475
3 changed files with 16 additions and 12 deletions
15
src/item.cc
15
src/item.cc
|
|
@ -158,11 +158,12 @@ void item_t::parse_tags(const char * p, int current_year)
|
||||||
|
|
||||||
void item_t::append_note(const char * p, int current_year)
|
void item_t::append_note(const char * p, int current_year)
|
||||||
{
|
{
|
||||||
if (note)
|
if (note) {
|
||||||
|
*note += '\n';
|
||||||
*note += p;
|
*note += p;
|
||||||
else
|
} else {
|
||||||
note = p;
|
note = p;
|
||||||
*note += '\n';
|
}
|
||||||
|
|
||||||
parse_tags(p, current_year);
|
parse_tags(p, current_year);
|
||||||
}
|
}
|
||||||
|
|
@ -251,15 +252,17 @@ namespace {
|
||||||
value_t get_comment(item_t& item)
|
value_t get_comment(item_t& item)
|
||||||
{
|
{
|
||||||
if (! item.note) {
|
if (! item.note) {
|
||||||
return false;
|
return string_value("");
|
||||||
} else {
|
} else {
|
||||||
|
// jww (2009-03-01): If the comment is a short one-liner, put it at the
|
||||||
|
// end of the post/xact
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
buf << "\n ;";
|
buf << "\n ;";
|
||||||
bool need_separator = false;
|
bool need_separator = false;
|
||||||
for (const char * p = item.note->c_str(); *p; p++) {
|
for (const char * p = item.note->c_str(); *p; p++) {
|
||||||
if (*p == '\n')
|
if (*p == '\n') {
|
||||||
need_separator = true;
|
need_separator = true;
|
||||||
else {
|
} else {
|
||||||
if (need_separator) {
|
if (need_separator) {
|
||||||
buf << "\n ;";
|
buf << "\n ;";
|
||||||
need_separator = false;
|
need_separator = false;
|
||||||
|
|
|
||||||
|
|
@ -267,6 +267,8 @@ value_t report_t::fn_join(call_scope_t& args)
|
||||||
foreach (const char ch, args[0].to_string())
|
foreach (const char ch, args[0].to_string())
|
||||||
if (ch != '\n')
|
if (ch != '\n')
|
||||||
out << ch;
|
out << ch;
|
||||||
|
else
|
||||||
|
out << "\\n";
|
||||||
|
|
||||||
return string_value(out.str());
|
return string_value(out.str());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
src/report.h
11
src/report.h
|
|
@ -301,10 +301,9 @@ public:
|
||||||
"%(quoted(payee)),"
|
"%(quoted(payee)),"
|
||||||
"%(quoted(account)),"
|
"%(quoted(account)),"
|
||||||
"%(quoted(scrub(display_amount))),"
|
"%(quoted(scrub(display_amount))),"
|
||||||
"%(quoted((cleared or xact.cleared) ?"
|
"%(quoted(cleared ? \"*\" : (pending ? \"!\" : \"\"))),"
|
||||||
" \"*\" : ((pending or xact.pending) ? \"!\" : \"\"))),"
|
|
||||||
"%(quoted(code)),"
|
"%(quoted(code)),"
|
||||||
"%(quoted(join(note)))\n");
|
"%(quoted(join(note | xact.note)))\n");
|
||||||
});
|
});
|
||||||
|
|
||||||
OPTION_(report_t, current, DO() { // -c
|
OPTION_(report_t, current, DO() { // -c
|
||||||
|
|
@ -521,21 +520,21 @@ public:
|
||||||
" \"=\" + format_date(xact.effective_date, \"%Y/%m/%d\") : \"\")"
|
" \"=\" + format_date(xact.effective_date, \"%Y/%m/%d\") : \"\")"
|
||||||
"%(xact.cleared ? \" *\" : (xact.pending ? \" !\" : \"\"))"
|
"%(xact.cleared ? \" *\" : (xact.pending ? \" !\" : \"\"))"
|
||||||
"%(code ? \" (\" + code + \")\" :"
|
"%(code ? \" (\" + code + \")\" :"
|
||||||
" \"\") %(payee)%(xact.comment | \"\")\n"
|
" \"\") %(payee)%(xact.comment)\n"
|
||||||
" %(xact.uncleared ?"
|
" %(xact.uncleared ?"
|
||||||
" (cleared ? \"* \" : (pending ? \"! \" : \"\")) : \"\")"
|
" (cleared ? \"* \" : (pending ? \"! \" : \"\")) : \"\")"
|
||||||
"%-34(account)"
|
"%-34(account)"
|
||||||
" %12(calculated ? \"\" : justify(scrub(amount), 12, -1, true))"
|
" %12(calculated ? \"\" : justify(scrub(amount), 12, -1, true))"
|
||||||
"%(has_cost & !cost_calculated ?"
|
"%(has_cost & !cost_calculated ?"
|
||||||
" \" @ \" + justify(scrub(abs(cost / amount)), 0) : \"\")"
|
" \" @ \" + justify(scrub(abs(cost / amount)), 0) : \"\")"
|
||||||
"%(comment | \"\")\n%/"
|
"%(comment)\n%/"
|
||||||
" %(xact.uncleared ?"
|
" %(xact.uncleared ?"
|
||||||
" (cleared ? \"* \" : (pending ? \"! \" : \"\")) : \"\")"
|
" (cleared ? \"* \" : (pending ? \"! \" : \"\")) : \"\")"
|
||||||
"%-34(account)"
|
"%-34(account)"
|
||||||
" %12(calculated ? \"\" : justify(scrub(amount), 12, -1, true))"
|
" %12(calculated ? \"\" : justify(scrub(amount), 12, -1, true))"
|
||||||
"%(has_cost & !cost_calculated ?"
|
"%(has_cost & !cost_calculated ?"
|
||||||
" \" @ \" + justify(scrub(abs(cost / amount)), 0) : \"\")"
|
" \" @ \" + justify(scrub(abs(cost / amount)), 0) : \"\")"
|
||||||
"%(comment | \"\")\n%/\n");
|
"%(comment)\n%/\n");
|
||||||
});
|
});
|
||||||
|
|
||||||
OPTION_(report_t, quantity, DO() { // -O
|
OPTION_(report_t, quantity, DO() { // -O
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue