summaryrefslogtreecommitdiff
path: root/src/item.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-06-18 02:21:02 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-06-18 02:21:02 -0400
commit7e2547b1e4c5b6e940506ddff80e8871ada029ea (patch)
tree859bf0cb08f64b0537d8d34055c872b744df02bc /src/item.cc
parentb8812209871eb2362c0b088774f1d023545e76cb (diff)
downloadfork-ledger-7e2547b1e4c5b6e940506ddff80e8871ada029ea.tar.gz
fork-ledger-7e2547b1e4c5b6e940506ddff80e8871ada029ea.tar.bz2
fork-ledger-7e2547b1e4c5b6e940506ddff80e8871ada029ea.zip
A metadata key must occur at the beginning
Before, this was valid: ; Today Yesterday: Tomorrow Which would set the key Yesterday to the value Tomorrow. Now, it is just an ordinary comment.
Diffstat (limited to 'src/item.cc')
-rw-r--r--src/item.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/item.cc b/src/item.cc
index 3845e4cb..9290ab2f 100644
--- a/src/item.cc
+++ b/src/item.cc
@@ -166,6 +166,7 @@ void item_t::parse_tags(const char * p,
string tag;
bool by_value = false;
+ bool first = true;
for (char * q = std::strtok(buf.get(), " \t");
q;
q = std::strtok(NULL, " \t")) {
@@ -191,7 +192,7 @@ void item_t::parse_tags(const char * p,
(*i).second.second = true;
}
}
- else if (q[len - 1] == ':') { // a metadata setting
+ else if (first && q[len - 1] == ':') { // a metadata setting
int index = 1;
if (q[len - 2] == ':') {
by_value = true;
@@ -199,6 +200,7 @@ void item_t::parse_tags(const char * p,
}
tag = string(q, len - index);
}
+ first = false;
}
}