j-palindrome / obsidian-time-ruler

A drag-and-drop time ruler combining the best of a task list and a calendar view (integrates with Tasks, Full Calendar, and Dataview).
MIT License
214 stars 7 forks source link

Path grouping should [optionally] select the last directory #128

Open theisjendal opened 1 month ago

theisjendal commented 1 month ago

Describe the solution you'd like I have deep directory paths, ending in something like .../projects/[project]/[taskNote]. However, currently the project will group by one of the first directories instead of [project]. It would therefore be very nice to have a toggle or define the depth of the directory to group by. For example, having 1, would select [project] as it's its parent directory, 2, would select projects its grandparent and so forth.

Describe alternatives you've considered Currently I've made two rather crude edits to accomplish this, in the function parseFolderFromPath I've added:

  if ((path2.match(/\//g) || []).length > 1 )
      s = path2.split("/");
      path2 = s.slice(s.length - 2).join("/");

and in the function splitHeading I've added:

  if ((heading.match(/\//g) || []).length > 1 ) {
    h = heading.split("/")
    heading = h.slice(h.length - 2).join("/")
  }

However, these overrule the current implementation. The simple solution is thus instead a toggle between this or the current implementation.