summaryrefslogtreecommitdiff
path: root/src/item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/item.cc')
-rw-r--r--src/item.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/item.cc b/src/item.cc
index 3a2b0b60..4ddbe913 100644
--- a/src/item.cc
+++ b/src/item.cc
@@ -172,19 +172,7 @@ void item_t::parse_tags(const char * p,
q = std::strtok(NULL, " \t")) {
const string::size_type len = std::strlen(q);
if (len < 2) continue;
- if (! tag.empty()) {
- string_map::iterator i;
- string field(p + (q - buf.get()));
- if (by_value) {
- bind_scope_t bound_scope(scope, *this);
- i = set_tag(tag, expr_t(field).calc(bound_scope), overwrite_existing);
- } else {
- i = set_tag(tag, string_value(field), overwrite_existing);
- }
- (*i).second.second = true;
- break;
- }
- else if (q[0] == ':' && q[len - 1] == ':') { // a series of tags
+ if (q[0] == ':' && q[len - 1] == ':') { // a series of tags
for (char * r = std::strtok(q + 1, ":");
r;
r = std::strtok(NULL, ":")) {
@@ -199,6 +187,18 @@ void item_t::parse_tags(const char * p,
index = 2;
}
tag = string(q, len - index);
+
+ string_map::iterator i;
+ string field(p + len + index);
+ trim(field);
+ if (by_value) {
+ bind_scope_t bound_scope(scope, *this);
+ i = set_tag(tag, expr_t(field).calc(bound_scope), overwrite_existing);
+ } else {
+ i = set_tag(tag, string_value(field), overwrite_existing);
+ }
+ (*i).second.second = true;
+ break;
}
first = false;
}