mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 04:27:20 +02:00
DOM
- Fixed DOM bug that was performing the lookup '1.due' by locating task 1, then attempting a get of the '1.due' attribute, instead of just 'due'.
This commit is contained in:
parent
330cc0218b
commit
bc12ac1ee6
2 changed files with 8 additions and 25 deletions
31
src/DOM.cpp
31
src/DOM.cpp
|
@ -107,28 +107,11 @@ const std::string DOM::get (const std::string& name)
|
|||
else if (len > 8 &&
|
||||
name.substr (0, 8) == "context.")
|
||||
{
|
||||
if (name == "context.program")
|
||||
return /*_cache[name] =*/ context.a3[0]._raw;
|
||||
|
||||
else if (name == "context.args")
|
||||
{
|
||||
return /*_cache[name] =*/ context.a3.combine ();
|
||||
}
|
||||
else if (name == "context.width")
|
||||
{
|
||||
std::stringstream s;
|
||||
s << context.terminal_width;
|
||||
return /*_cache[name] =*/ s.str ();
|
||||
}
|
||||
else if (name == "context.height")
|
||||
{
|
||||
std::stringstream s;
|
||||
s << context.terminal_height;
|
||||
return /*_cache[name] =*/ s.str ();
|
||||
}
|
||||
|
||||
else
|
||||
throw format (STRING_DOM_UNREC, name);
|
||||
if (name == "context.program") return /*_cache[name] =*/ context.a3[0]._raw;
|
||||
else if (name == "context.args") return /*_cache[name] =*/ context.a3.combine ();
|
||||
else if (name == "context.width") return /*_cache[name] =*/ format (context.terminal_width);
|
||||
else if (name == "context.height") return /*_cache[name] =*/ format (context.terminal_height);
|
||||
else throw format (STRING_DOM_UNREC, name);
|
||||
}
|
||||
|
||||
// TODO stats.<name>
|
||||
|
@ -246,7 +229,7 @@ const std::string DOM::get (const std::string& name, const Task& task)
|
|||
|
||||
if (attr == "id") return format (ref.id);
|
||||
else if (attr == "urgency") return format (ref.urgency_c (), 4, 3);
|
||||
else if (A3::is_attribute (name, canonical)) return ref.get (canonical);
|
||||
else if (A3::is_attribute (attr, canonical)) return ref.get (canonical);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,7 +249,7 @@ const std::string DOM::get (const std::string& name, const Task& task)
|
|||
|
||||
if (name == "id") return format (ref.id);
|
||||
else if (name == "urgency") return format (ref.urgency_c (), 4, 3);
|
||||
else if (A3::is_attribute (name, canonical)) return ref.get (canonical);
|
||||
else if (A3::is_attribute (attr, canonical)) return ref.get (canonical);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue