diff options
Diffstat (limited to 'src/item.cc')
-rw-r--r-- | src/item.cc | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/item.cc b/src/item.cc index 02983ba1..27d28782 100644 --- a/src/item.cc +++ b/src/item.cc @@ -71,6 +71,21 @@ void item_t::set_tag(const string& tag, void item_t::parse_tags(const char * p) { + if (char * b = std::strchr(p, '[')) { + if (char * e = std::strchr(p, ']')) { + char buf[256]; + std::strncpy(buf, b + 1, e - b - 1); + buf[e - b - 1] = '\0'; + + if (char * p = std::strchr(buf, '=')) { + *p++ = '\0'; + _date_eff = parse_date(p); + } + if (buf[0]) + _date = parse_date(buf); + } + } + if (! std::strchr(p, ':')) return; @@ -99,6 +114,17 @@ void item_t::parse_tags(const char * p) } } +void item_t::append_note(const char * p) +{ + if (note) + *note += p; + else + note = p; + *note += '\n'; + + parse_tags(p); +} + namespace { value_t get_status(item_t& item) { return long(item.state()); @@ -325,9 +351,9 @@ string item_context(const item_t& item) out << "While balancing item from \"" << item.pathname.string() << "\""; - if (item.beg_line != (item.end_line - 1)) + if (item.beg_line != item.end_line) out << ", lines " << item.beg_line << "-" - << (item.end_line - 1) << ":\n"; + << item.end_line << ":\n"; else out << ", line " << item.beg_line << ":\n"; |