dentropys-obsidian-publisher troubleshooting

  • We need to loop through a series of file paths and their contents and create a file structure like the following in javascript
  • We are adding path /one/two/three/hello.txt holds the contents "qwerty"
push {one : []} to []
push {two: []} to [0]["One"]
push {three: []} to [0]["One"][0]["Two"]
push {"hello.txt" : "qwerty"} to [0]["One"][0]["Two"][0]["Three"]

Final data structure looks like

[{
  "one": [{
    "two": [{
      "Three": {
        "hello.txt": "qwerty"
      }
    }]
  }]
}]
// console.log( Array.isArray(note_filepaths) )


/*

What format do we need?

We need

Title :
  uuid
  Title: UUID

How do we loop through these to create this structure

We need to parse and sort by length

*/



/*

We seem to have a usable file hierarchy structure

So we start embedding the lists inside lists now?

Recursive Loop
  Check length is what we started with
  Check if same length otherwise reduce by one
  Check second last item in path and put them in a object
    {
      name: 
      parsed_length:
      notes: 
        {name : uuid}
    }

Where do we store these?
We need a meta object
*/

// let notes_to_insert = {}
// let final_notes_object = {}
// let final_notes_yaml = ""

// function recursive_yaml_generator(notes_with_metadata){
//   const list_item = notes_with_metadata.shift();
//   recursive_yaml_generator(notes_with_metadata)

// }



/*

I asked ChatGPT "Place items within a recursive list structure based on file path"

Let's test the result

{
  "note_path": "pkm/Root/dentropydaemon-wiki/Software/List/linux/Files  Users  Groups  Permissions/linux file exercises/linux user and group exercises/linux user and group exercises solutions.md",
  "uuid": "81b41957-894c-48fc-901f-dc405a5a092a",
  "parsed": ["pkm", "Root", "dentropydaemon-wiki", "Software", "List", "linux", "Files  Users  Groups  Permissions", "linux file exercises", "linux user and group exercises", "linux user and group exercises solutions.md"],
  "parsed_length": 10
}

*/


/*
Loop through list
Find object with the key you are looking for
Over and over
*/