diff options
author | Richard M Kreuter <186215+kreuter@users.noreply.github.com> | 2021-05-30 07:52:14 -0400 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2021-05-31 17:16:52 +0800 |
commit | 592a5c94a110f44073f7b92f9d4dfe313f3cdf93 (patch) | |
tree | 2f88f8e79525be2d9285894fc7611f0177dabf42 /src/emacs.cc | |
parent | ed5f7ccb9c93946913ac3ecc4132bf8e42260fd3 (diff) | |
download | fork-ledger-592a5c94a110f44073f7b92f9d4dfe313f3cdf93.tar.gz fork-ledger-592a5c94a110f44073f7b92f9d4dfe313f3cdf93.tar.bz2 fork-ledger-592a5c94a110f44073f7b92f9d4dfe313f3cdf93.zip |
Escape all string values output by the lisp report.
Notes were already being escaped. The filename, the transaction code,
the payee,, postings' account names, and postings' cost expressions
were not. Everything else the lisp report prints appears to be a
number or a constant-valued non-string token for Lisp.
Diffstat (limited to 'src/emacs.cc')
-rw-r--r-- | src/emacs.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/emacs.cc b/src/emacs.cc index 52389316..9092bb4b 100644 --- a/src/emacs.cc +++ b/src/emacs.cc @@ -41,7 +41,7 @@ namespace ledger { void format_emacs_posts::write_xact(xact_t& xact) { if (xact.pos) - out << "\"" << xact.pos->pathname.string() << "\" " + out << "\"" << escape_string(xact.pos->pathname.string()) << "\" " << xact.pos->beg_line << " "; else out << "\"\" " << -1 << " "; @@ -52,14 +52,14 @@ namespace ledger { out << "(" << (date / 65536) << " " << (date % 65536) << " 0) "; if (xact.code) - out << "\"" << *xact.code << "\" "; + out << "\"" << escape_string(*xact.code) << "\" "; else out << "nil "; if (xact.payee.empty()) out << "nil"; else - out << "\"" << xact.payee << "\""; + out << "\"" << escape_string(xact.payee) << "\""; out << "\n"; } @@ -85,8 +85,8 @@ namespace ledger { else out << " (" << -1 << " "; - out << "\"" << post.reported_account()->fullname() << "\" \"" - << post.amount << "\""; + out << "\"" << escape_string(post.reported_account()->fullname()) << "\" \"" + << escape_string(post.amount) << "\""; switch (post.state()) { case item_t::UNCLEARED: @@ -101,7 +101,7 @@ namespace ledger { } if (post.cost) - out << " \"" << *post.cost << "\""; + out << " \"" << escape_string(*post.cost) << "\""; if (post.note) out << " \"" << escape_string(*post.note) << "\""; out << ")"; |