summaryrefslogtreecommitdiff
path: root/src/commodity.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-14 03:45:32 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-14 03:46:50 -0400
commitc2a77c12377e6dcecb9ba50274a3896412f5eaaf (patch)
treeea4a22f878400cbdcd2baf2f0d5aeeb166b55b01 /src/commodity.cc
parentdcffd218a1e90ee9a1cdd295c0a3015edc395448 (diff)
downloadfork-ledger-c2a77c12377e6dcecb9ba50274a3896412f5eaaf.tar.gz
fork-ledger-c2a77c12377e6dcecb9ba50274a3896412f5eaaf.tar.bz2
fork-ledger-c2a77c12377e6dcecb9ba50274a3896412f5eaaf.zip
Don't elide quotes for all-digit commodities
Diffstat (limited to 'src/commodity.cc')
-rw-r--r--src/commodity.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/commodity.cc b/src/commodity.cc
index 230113e8..179bbc05 100644
--- a/src/commodity.cc
+++ b/src/commodity.cc
@@ -646,9 +646,13 @@ void commodity_t::print(std::ostream& out, bool elide_quotes) const
{
string sym = symbol();
if (elide_quotes && has_flags(COMMODITY_STYLE_SEPARATED) &&
- ! sym.empty() && sym[0] == '"' && ! std::strchr(sym.c_str(), ' ')) {
- DEBUG("foo", "contracting " << sym << " to " << string(sym, 1, sym.length() - 2));
- out << string(sym, 1, sym.length() - 2);
+ ! sym.empty() && sym[0] == '"' &&
+ ! std::strchr(sym.c_str(), ' ')) {
+ string subsym(sym, 1, sym.length() - 2);
+ if (! all(subsym, is_digit()))
+ out << subsym;
+ else
+ out << sym;
} else
out << sym;
}