out-of-cheese-error / gooseberry

A command line utility to generate a knowledge base from Hypothesis annotations
Apache License 2.0
152 stars 9 forks source link

Take into account the existence of `/` in tags when creating the knowledge base directory structure #85

Closed ngirard closed 3 years ago

ngirard commented 3 years ago

As discusssed in #79, it makes sense for e.g. Obsidian users that tags contain a slash.

However, along with hierarchy = ['Tag'], this leads to the following error:

gooseberry make
✔ Clear knowledge base directory? · yes
Error: 
   0: No such file or directory (os error 2)

Location:
   /home/ngirard/sandboxes/rust/gooseberry.git/src/gooseberry/knowledge_base.rs:370

There are several possible strategies in this scenario. The first one to come to mind would be to translate parent/child1 and parent/child2 into the following directory structure:

kb_dir/
\__ parent/
    \__ child1.md
    \__ child2.md

which I'd be fine with ; but I haven gotten further thought about the alternatives.

Ninjani commented 3 years ago

The first one to come to mind would be to translate parent/child1 and parent/child2 into the following directory structure:

This ended up being pretty easy to implement but will likely come back to bite me when I get around to adding Windows support in #55 :p

ngirard commented 3 years ago

Thank you very much !

will likely come back to bite me when I get around to adding Windows support

Hopefully replacing all / with std::path::MAIN_SEPARATOR would be enough...?

Ninjani commented 3 years ago

Good point, I've done that now and hopefully that'll be the end of it.

ngirard commented 3 years ago

Do you feel ready to merge the branch, so I can take advantage of it ?

Ninjani commented 3 years ago

I've merged it now, but would like to add some more documentation to the README before making a new release

Ninjani commented 3 years ago

I'm reopening this because I want to add a configuration option to set the nested tag character instead of hard-coding it as "/" - for instance in org-mode this would be " : ".

ngirard commented 3 years ago

Thanks ! And sorry for not contributing to the docs :-/